All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.trypticon.hex.interpreters.strings.BinaryStringInterpreter Maven / Gradle / Ivy

There is a newer version: 0.8.0
Show newest version
package org.trypticon.hex.interpreters.strings;

import org.trypticon.hex.binary.Binary;
import org.trypticon.hex.interpreters.AbstractInterpreter;

/**
 * Interpreter for binary string values.
 *
 * @author trejkaz
 */
public class BinaryStringInterpreter extends AbstractInterpreter {
    public BinaryStringInterpreter() {
        super(BinaryStringValue.class);
    }

    @Override
    public BinaryStringValue interpret(Binary binary, long position, long length) {
        if (length > Integer.MAX_VALUE) {
            throw new IllegalArgumentException("Strings cannot be longer than Integer.MAX_VALUE: " + length);
        }

        return new SimpleBinaryStringValue(binary.slice(position, length));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy