|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.tika.io.EndianUtils
public class EndianUtils
General Endian Related Utilties.
This class provides static utility methods for input/output operations on numbers in Big and Little Endian formats.
Origin of code: Based on the version in POI
Nested Class Summary | |
---|---|
static class |
EndianUtils.BufferUnderrunException
|
Constructor Summary | |
---|---|
EndianUtils()
|
Method Summary | |
---|---|
static int |
getIntBE(byte[] data)
Get a BE int value from the beginning of a byte array |
static int |
getIntBE(byte[] data,
int offset)
Get a BE int value from a byte array |
static int |
getIntLE(byte[] data)
Get a LE int value from the beginning of a byte array |
static int |
getIntLE(byte[] data,
int offset)
Get a LE int value from a byte array |
static long |
getLongLE(byte[] data,
int offset)
Get a LE long value from a byte array |
static short |
getShortBE(byte[] data)
Get a BE short value from the beginning of a byte array |
static short |
getShortBE(byte[] data,
int offset)
Get a BE short value from a byte array |
static short |
getShortLE(byte[] data)
Get a LE short value from the beginning of a byte array |
static short |
getShortLE(byte[] data,
int offset)
Get a LE short value from a byte array |
static short |
getUByte(byte[] data,
int offset)
get the unsigned value of a byte. |
static long |
getUIntBE(byte[] data)
Get a BE unsigned int value from a byte array |
static long |
getUIntBE(byte[] data,
int offset)
Get a BE unsigned int value from a byte array |
static long |
getUIntLE(byte[] data)
Get a LE unsigned int value from a byte array |
static long |
getUIntLE(byte[] data,
int offset)
Get a LE unsigned int value from a byte array |
static int |
getUShortBE(byte[] data)
Get a BE unsigned short value from the beginning of a byte array |
static int |
getUShortBE(byte[] data,
int offset)
Get a BE unsigned short value from a byte array |
static int |
getUShortLE(byte[] data)
Get a LE unsigned short value from the beginning of a byte array |
static int |
getUShortLE(byte[] data,
int offset)
Get a LE unsigned short value from a byte array |
static int |
readIntBE(InputStream stream)
Get a BE int value from an InputStream |
static int |
readIntLE(InputStream stream)
Get a LE int value from an InputStream |
static long |
readLongBE(InputStream stream)
Get a NE long value from an InputStream |
static long |
readLongLE(InputStream stream)
Get a LE long value from an InputStream |
static short |
readShortBE(InputStream stream)
Get a BE short value from an InputStream |
static short |
readShortLE(InputStream stream)
Get a LE short value from an InputStream |
static int |
readUShortBE(InputStream stream)
|
static int |
readUShortLE(InputStream stream)
|
static int |
ubyteToInt(byte b)
Convert an 'unsigned' byte to an integer. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public EndianUtils()
Method Detail |
---|
public static short readShortLE(InputStream stream) throws IOException, EndianUtils.BufferUnderrunException
stream
- the InputStream from which the short is to be read
IOException
- will be propagated back to the caller
EndianUtils.BufferUnderrunException
- if the stream cannot provide enough bytespublic static short readShortBE(InputStream stream) throws IOException, EndianUtils.BufferUnderrunException
stream
- the InputStream from which the short is to be read
IOException
- will be propagated back to the caller
EndianUtils.BufferUnderrunException
- if the stream cannot provide enough bytespublic static int readUShortLE(InputStream stream) throws IOException, EndianUtils.BufferUnderrunException
IOException
EndianUtils.BufferUnderrunException
public static int readUShortBE(InputStream stream) throws IOException, EndianUtils.BufferUnderrunException
IOException
EndianUtils.BufferUnderrunException
public static int readIntLE(InputStream stream) throws IOException, EndianUtils.BufferUnderrunException
stream
- the InputStream from which the int is to be read
IOException
- will be propagated back to the caller
EndianUtils.BufferUnderrunException
- if the stream cannot provide enough bytespublic static int readIntBE(InputStream stream) throws IOException, EndianUtils.BufferUnderrunException
stream
- the InputStream from which the int is to be read
IOException
- will be propagated back to the caller
EndianUtils.BufferUnderrunException
- if the stream cannot provide enough bytespublic static long readLongLE(InputStream stream) throws IOException, EndianUtils.BufferUnderrunException
stream
- the InputStream from which the long is to be read
IOException
- will be propagated back to the caller
EndianUtils.BufferUnderrunException
- if the stream cannot provide enough bytespublic static long readLongBE(InputStream stream) throws IOException, EndianUtils.BufferUnderrunException
stream
- the InputStream from which the long is to be read
IOException
- will be propagated back to the caller
EndianUtils.BufferUnderrunException
- if the stream cannot provide enough bytespublic static short getShortLE(byte[] data)
data
- the byte array
public static short getShortLE(byte[] data, int offset)
data
- the byte arrayoffset
- a starting offset into the byte array
public static int getUShortLE(byte[] data)
data
- the byte array
public static int getUShortLE(byte[] data, int offset)
data
- the byte arrayoffset
- a starting offset into the byte array
public static short getShortBE(byte[] data)
data
- the byte array
public static short getShortBE(byte[] data, int offset)
data
- the byte arrayoffset
- a starting offset into the byte array
public static int getUShortBE(byte[] data)
data
- the byte array
public static int getUShortBE(byte[] data, int offset)
data
- the byte arrayoffset
- a starting offset into the byte array
public static int getIntLE(byte[] data)
data
- the byte array
public static int getIntLE(byte[] data, int offset)
data
- the byte arrayoffset
- a starting offset into the byte array
public static int getIntBE(byte[] data)
data
- the byte array
public static int getIntBE(byte[] data, int offset)
data
- the byte arrayoffset
- a starting offset into the byte array
public static long getUIntLE(byte[] data)
data
- the byte array
public static long getUIntLE(byte[] data, int offset)
data
- the byte arrayoffset
- a starting offset into the byte array
public static long getUIntBE(byte[] data)
data
- the byte array
public static long getUIntBE(byte[] data, int offset)
data
- the byte arrayoffset
- a starting offset into the byte array
public static long getLongLE(byte[] data, int offset)
data
- the byte arrayoffset
- a starting offset into the byte array
public static int ubyteToInt(byte b)
b
- Description of the Parameter
public static short getUByte(byte[] data, int offset)
data
- the byte array.offset
- a starting offset into the byte array.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |