public class BinaryFileFunctions extends Object implements BinaryConstants
Modifier and Type | Field and Description |
---|---|
protected boolean |
debug |
BYTE_ORDER_BIG_ENDIAN, BYTE_ORDER_INTEL, BYTE_ORDER_LEAST_SIGNIFICANT_BYTE, BYTE_ORDER_LITTLE_ENDIAN, BYTE_ORDER_LSB, BYTE_ORDER_MOST_SIGNIFICANT_BYTE, BYTE_ORDER_MOTOROLA, BYTE_ORDER_MSB, BYTE_ORDER_NETWORK
Constructor and Description |
---|
BinaryFileFunctions() |
Modifier and Type | Method and Description |
---|---|
static int |
CharsToQuad(char c1,
char c2,
char c3,
char c4) |
boolean |
compareByteArrays(byte[] a,
byte[] b) |
boolean |
compareByteArrays(byte[] a,
int aStart,
byte[] b,
int bStart,
int length) |
static boolean |
compareBytes(byte[] a,
byte[] b) |
static boolean |
compareBytes(byte[] a,
int aStart,
byte[] b,
int bStart,
int length) |
protected double |
convertByteArrayToDouble(String name,
byte[] bytes,
int byteOrder) |
protected double |
convertByteArrayToDouble(String name,
byte[] bytes,
int start,
int byteOrder) |
protected double[] |
convertByteArrayToDoubleArray(String name,
byte[] bytes,
int start,
int length,
int byteOrder) |
protected float |
convertByteArrayToFloat(String name,
byte[] bytes,
int byteOrder) |
protected float |
convertByteArrayToFloat(String name,
byte[] bytes,
int start,
int byteOrder) |
protected float[] |
convertByteArrayToFloatArray(String name,
byte[] bytes,
int start,
int length,
int byteOrder) |
protected int |
convertByteArrayToInt(String name,
byte[] bytes,
int byteOrder) |
protected int |
convertByteArrayToInt(String name,
byte[] bytes,
int start,
int byteOrder) |
protected int[] |
convertByteArrayToIntArray(String name,
byte[] bytes,
int start,
int length,
int byteOrder) |
protected RationalNumber |
convertByteArrayToRational(String name,
byte[] bytes,
int byteOrder) |
protected RationalNumber |
convertByteArrayToRational(String name,
byte[] bytes,
int start,
int byteOrder) |
protected RationalNumber[] |
convertByteArrayToRationalArray(String name,
byte[] bytes,
int start,
int length,
int byteOrder) |
protected int |
convertByteArrayToShort(String name,
byte[] bytes,
int byteOrder) |
protected int |
convertByteArrayToShort(String name,
int index,
byte[] bytes,
int byteOrder) |
protected int[] |
convertByteArrayToShortArray(String name,
byte[] bytes,
int start,
int length,
int byteOrder) |
protected byte[] |
convertDoubleArrayToByteArray(double[] values,
int byteOrder) |
protected byte[] |
convertDoubleToByteArray(double value,
int byteOrder) |
protected byte[] |
convertFloatArrayToByteArray(float[] values,
int byteOrder) |
protected byte[] |
convertFloatToByteArray(float value,
int byteOrder) |
protected byte[] |
convertIntArrayToByteArray(int[] values,
int byteOrder) |
protected byte[] |
convertIntArrayToRationalArray(int[] numerators,
int[] denominators,
int byteOrder) |
protected byte[] |
convertRationalArrayToByteArray(RationalNumber[] numbers,
int byteOrder) |
protected byte[] |
convertRationalToByteArray(RationalNumber number,
int byteOrder) |
protected byte[] |
convertShortArrayToByteArray(int[] values,
int byteOrder) |
protected byte[] |
convertShortToByteArray(int value,
int byteOrder) |
void |
copyStreamToStream(InputStream is,
OutputStream os) |
void |
debugByteArray(String name,
byte[] bytes) |
void |
debugNumber(PrintWriter pw,
String msg,
int data) |
void |
debugNumber(PrintWriter pw,
String msg,
int data,
int bytes) |
void |
debugNumber(String msg,
int data) |
void |
debugNumber(String msg,
int data,
int bytes) |
protected void |
debugNumberArray(String name,
int[] numbers,
int length) |
int |
findNull(byte[] src) |
int |
findNull(byte[] src,
int start) |
protected byte[] |
getBytearrayHead(String name,
byte[] bytes,
int count) |
protected byte[] |
getByteArrayTail(String name,
byte[] bytes,
int count) |
boolean |
getDebug() |
protected byte[] |
getRAFBytes(RandomAccessFile raf,
long pos,
int length,
String exception) |
byte[] |
getStreamBytes(InputStream is) |
static byte[] |
head(byte[] bytes,
int count) |
protected static byte[] |
int2ToByteArray(int value,
int byteOrder) |
protected void |
printByteBits(String msg,
byte i) |
protected void |
printCharQuad(PrintWriter pw,
String msg,
int i) |
protected void |
printCharQuad(String msg,
int i) |
protected int |
read2Bytes(String name,
InputStream is,
String exception,
int byteOrder) |
protected int |
read3Bytes(String name,
InputStream is,
String exception,
int byteOrder) |
protected int |
read4Bytes(String name,
InputStream is,
String exception,
int byteOrder) |
void |
readAndVerifyBytes(InputStream is,
byte[] expected,
String exception) |
protected void |
readAndVerifyBytes(String name,
InputStream is,
byte[] expected,
String exception) |
byte |
readByte(String name,
InputStream is,
String exception) |
byte[] |
readBytearray(String name,
byte[] bytes,
int start,
int count) |
byte[] |
readByteArray(String name,
int length,
InputStream is) |
byte[] |
readByteArray(String name,
int length,
InputStream is,
String exception) |
byte[] |
readBytes(InputStream is,
int count) |
protected void |
readRandomBytes(InputStream is) |
protected void |
scanForByte(InputStream is,
byte value) |
void |
setDebug(boolean b) |
protected void |
skipBytes(InputStream is,
int length) |
void |
skipBytes(InputStream is,
int length,
String exception) |
static byte[] |
slice(byte[] bytes,
int start,
int count) |
boolean |
startsWith(byte[] haystack,
byte[] needle) |
static byte[] |
tail(byte[] bytes,
int count) |
protected void |
writeIntInToByteArray(int value,
byte[] bytes,
int start,
int byteOrder) |
public final void setDebug(boolean b)
public final boolean getDebug()
protected final void readRandomBytes(InputStream is) throws ImageReadException, IOException
ImageReadException
IOException
public final void debugNumber(String msg, int data)
public final void debugNumber(String msg, int data, int bytes)
public final void debugNumber(PrintWriter pw, String msg, int data)
public final void debugNumber(PrintWriter pw, String msg, int data, int bytes)
public final boolean startsWith(byte[] haystack, byte[] needle)
public final byte[] readBytes(InputStream is, int count) throws ImageReadException, IOException
ImageReadException
IOException
public final void readAndVerifyBytes(InputStream is, byte[] expected, String exception) throws ImageReadException, IOException
ImageReadException
IOException
protected final void readAndVerifyBytes(String name, InputStream is, byte[] expected, String exception) throws ImageReadException, IOException
ImageReadException
IOException
public final void skipBytes(InputStream is, int length, String exception) throws IOException
IOException
protected final void scanForByte(InputStream is, byte value) throws IOException
IOException
public final byte readByte(String name, InputStream is, String exception) throws ImageReadException, IOException
ImageReadException
IOException
protected final RationalNumber[] convertByteArrayToRationalArray(String name, byte[] bytes, int start, int length, int byteOrder)
protected final RationalNumber convertByteArrayToRational(String name, byte[] bytes, int byteOrder)
protected final RationalNumber convertByteArrayToRational(String name, byte[] bytes, int start, int byteOrder)
protected final int convertByteArrayToInt(String name, byte[] bytes, int byteOrder)
protected final int convertByteArrayToInt(String name, byte[] bytes, int start, int byteOrder)
protected final int[] convertByteArrayToIntArray(String name, byte[] bytes, int start, int length, int byteOrder)
protected final void writeIntInToByteArray(int value, byte[] bytes, int start, int byteOrder)
protected static final byte[] int2ToByteArray(int value, int byteOrder)
protected final byte[] convertIntArrayToByteArray(int[] values, int byteOrder)
protected final byte[] convertShortArrayToByteArray(int[] values, int byteOrder)
protected final byte[] convertShortToByteArray(int value, int byteOrder)
protected final byte[] convertIntArrayToRationalArray(int[] numerators, int[] denominators, int byteOrder) throws ImageWriteException
ImageWriteException
protected final byte[] convertRationalArrayToByteArray(RationalNumber[] numbers, int byteOrder) throws ImageWriteException
ImageWriteException
protected final byte[] convertRationalToByteArray(RationalNumber number, int byteOrder) throws ImageWriteException
ImageWriteException
protected final int convertByteArrayToShort(String name, byte[] bytes, int byteOrder) throws ImageReadException
ImageReadException
protected final int convertByteArrayToShort(String name, int index, byte[] bytes, int byteOrder) throws ImageReadException
ImageReadException
protected final int[] convertByteArrayToShortArray(String name, byte[] bytes, int start, int length, int byteOrder) throws ImageReadException
ImageReadException
public final byte[] readByteArray(String name, int length, InputStream is) throws IOException
IOException
public final byte[] readByteArray(String name, int length, InputStream is, String exception) throws IOException
IOException
public final void debugByteArray(String name, byte[] bytes)
protected final void debugNumberArray(String name, int[] numbers, int length)
public final byte[] readBytearray(String name, byte[] bytes, int start, int count) throws ImageReadException
ImageReadException
protected final byte[] getByteArrayTail(String name, byte[] bytes, int count) throws ImageReadException
ImageReadException
protected final byte[] getBytearrayHead(String name, byte[] bytes, int count) throws ImageReadException
ImageReadException
public static final byte[] slice(byte[] bytes, int start, int count)
public static final byte[] tail(byte[] bytes, int count)
public static final byte[] head(byte[] bytes, int count)
public final boolean compareByteArrays(byte[] a, byte[] b)
public final boolean compareByteArrays(byte[] a, int aStart, byte[] b, int bStart, int length)
public static final boolean compareBytes(byte[] a, byte[] b)
public static final boolean compareBytes(byte[] a, int aStart, byte[] b, int bStart, int length)
protected final int read4Bytes(String name, InputStream is, String exception, int byteOrder) throws ImageReadException, IOException
ImageReadException
IOException
protected final int read3Bytes(String name, InputStream is, String exception, int byteOrder) throws ImageReadException, IOException
ImageReadException
IOException
protected final int read2Bytes(String name, InputStream is, String exception, int byteOrder) throws ImageReadException, IOException
ImageReadException
IOException
protected final void printCharQuad(String msg, int i)
protected final void printCharQuad(PrintWriter pw, String msg, int i)
protected final void printByteBits(String msg, byte i)
public static final int CharsToQuad(char c1, char c2, char c3, char c4)
public final int findNull(byte[] src)
public final int findNull(byte[] src, int start)
protected final byte[] getRAFBytes(RandomAccessFile raf, long pos, int length, String exception) throws IOException
IOException
protected final float convertByteArrayToFloat(String name, byte[] bytes, int byteOrder)
protected final float convertByteArrayToFloat(String name, byte[] bytes, int start, int byteOrder)
protected final float[] convertByteArrayToFloatArray(String name, byte[] bytes, int start, int length, int byteOrder)
protected final byte[] convertFloatToByteArray(float value, int byteOrder)
protected final byte[] convertFloatArrayToByteArray(float[] values, int byteOrder)
protected final byte[] convertDoubleToByteArray(double value, int byteOrder)
protected final byte[] convertDoubleArrayToByteArray(double[] values, int byteOrder)
protected final double convertByteArrayToDouble(String name, byte[] bytes, int byteOrder)
protected final double convertByteArrayToDouble(String name, byte[] bytes, int start, int byteOrder)
protected final double[] convertByteArrayToDoubleArray(String name, byte[] bytes, int start, int length, int byteOrder)
protected void skipBytes(InputStream is, int length) throws IOException
IOException
public final void copyStreamToStream(InputStream is, OutputStream os) throws IOException
IOException
public final byte[] getStreamBytes(InputStream is) throws IOException
IOException
Copyright © 2007-2012. All Rights Reserved.