Package org.apache.tika.io
Class EndianUtils
java.lang.Object
org.apache.tika.io.EndianUtils
Deprecated.
This version of the Apache Tika library is deprecated. Use your own version of Apache Tika.
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
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intgetIntBE(byte[] data) Deprecated.Get a BE int value from the beginning of a byte arraystatic intgetIntBE(byte[] data, int offset) Deprecated.Get a BE int value from a byte arraystatic intgetIntLE(byte[] data) Deprecated.Get a LE int value from the beginning of a byte arraystatic intgetIntLE(byte[] data, int offset) Deprecated.Get a LE int value from a byte arraystatic longgetLongLE(byte[] data, int offset) Deprecated.Get a LE long value from a byte arraystatic shortgetShortBE(byte[] data) Deprecated.Get a BE short value from the beginning of a byte arraystatic shortgetShortBE(byte[] data, int offset) Deprecated.Get a BE short value from a byte arraystatic shortgetShortLE(byte[] data) Deprecated.Get a LE short value from the beginning of a byte arraystatic shortgetShortLE(byte[] data, int offset) Deprecated.Get a LE short value from a byte arraystatic shortgetUByte(byte[] data, int offset) Deprecated.get the unsigned value of a byte.static longgetUIntBE(byte[] data) Deprecated.Get a BE unsigned int value from a byte arraystatic longgetUIntBE(byte[] data, int offset) Deprecated.Get a BE unsigned int value from a byte arraystatic longgetUIntLE(byte[] data) Deprecated.Get a LE unsigned int value from a byte arraystatic longgetUIntLE(byte[] data, int offset) Deprecated.Get a LE unsigned int value from a byte arraystatic intgetUShortBE(byte[] data) Deprecated.Get a BE unsigned short value from the beginning of a byte arraystatic intgetUShortBE(byte[] data, int offset) Deprecated.Get a BE unsigned short value from a byte arraystatic intgetUShortLE(byte[] data) Deprecated.Get a LE unsigned short value from the beginning of a byte arraystatic intgetUShortLE(byte[] data, int offset) Deprecated.Get a LE unsigned short value from a byte arraystatic intreadIntBE(InputStream stream) Deprecated.Get a BE int value from an InputStreamstatic intreadIntLE(InputStream stream) Deprecated.Get a LE int value from an InputStreamstatic longreadLongBE(InputStream stream) Deprecated.Get a NE long value from an InputStreamstatic longreadLongLE(InputStream stream) Deprecated.Get a LE long value from an InputStreamstatic shortreadShortBE(InputStream stream) Deprecated.Get a BE short value from an InputStreamstatic shortreadShortLE(InputStream stream) Deprecated.Get a LE short value from an InputStreamstatic longreadUE7(InputStream stream) Deprecated.Gets the integer value that is stored in UTF-8 like fashion, in Big Endian but with the high bit on each number indicating if it continues or notstatic longreadUIntBE(InputStream stream) Deprecated.Get a BE unsigned int value from an InputStreamstatic longreadUIntLE(InputStream stream) Deprecated.Get a LE unsigned int value from an InputStreamstatic intreadUShortBE(InputStream stream) Deprecated.static intreadUShortLE(InputStream stream) Deprecated.static intubyteToInt(byte b) Deprecated.Convert an 'unsigned' byte to an integer.
-
Constructor Details
-
EndianUtils
public EndianUtils()Deprecated.
-
-
Method Details
-
readShortLE
public static short readShortLE(InputStream stream) throws IOException, EndianUtils.BufferUnderrunException Deprecated.Get a LE short value from an InputStream- Parameters:
stream- the InputStream from which the short is to be read- Returns:
- the short (16-bit) value
- Throws:
IOException- will be propagated back to the callerEndianUtils.BufferUnderrunException- if the stream cannot provide enough bytes
-
readShortBE
public static short readShortBE(InputStream stream) throws IOException, EndianUtils.BufferUnderrunException Deprecated.Get a BE short value from an InputStream- Parameters:
stream- the InputStream from which the short is to be read- Returns:
- the short (16-bit) value
- Throws:
IOException- will be propagated back to the callerEndianUtils.BufferUnderrunException- if the stream cannot provide enough bytes
-
readUShortLE
public static int readUShortLE(InputStream stream) throws IOException, EndianUtils.BufferUnderrunException Deprecated. -
readUShortBE
public static int readUShortBE(InputStream stream) throws IOException, EndianUtils.BufferUnderrunException Deprecated. -
readUIntLE
public static long readUIntLE(InputStream stream) throws IOException, EndianUtils.BufferUnderrunException Deprecated.Get a LE unsigned int value from an InputStream- Parameters:
stream- the InputStream from which the int is to be read- Returns:
- the int (32-bit) value
- Throws:
IOException- will be propagated back to the callerEndianUtils.BufferUnderrunException- if the stream cannot provide enough bytes
-
readUIntBE
public static long readUIntBE(InputStream stream) throws IOException, EndianUtils.BufferUnderrunException Deprecated.Get a BE unsigned int value from an InputStream- Parameters:
stream- the InputStream from which the int is to be read- Returns:
- the int (32-bit) value
- Throws:
IOException- will be propagated back to the callerEndianUtils.BufferUnderrunException- if the stream cannot provide enough bytes
-
readIntLE
public static int readIntLE(InputStream stream) throws IOException, EndianUtils.BufferUnderrunException Deprecated.Get a LE int value from an InputStream- Parameters:
stream- the InputStream from which the int is to be read- Returns:
- the int (32-bit) value
- Throws:
IOException- will be propagated back to the callerEndianUtils.BufferUnderrunException- if the stream cannot provide enough bytes
-
readIntBE
public static int readIntBE(InputStream stream) throws IOException, EndianUtils.BufferUnderrunException Deprecated.Get a BE int value from an InputStream- Parameters:
stream- the InputStream from which the int is to be read- Returns:
- the int (32-bit) value
- Throws:
IOException- will be propagated back to the callerEndianUtils.BufferUnderrunException- if the stream cannot provide enough bytes
-
readLongLE
public static long readLongLE(InputStream stream) throws IOException, EndianUtils.BufferUnderrunException Deprecated.Get a LE long value from an InputStream- Parameters:
stream- the InputStream from which the long is to be read- Returns:
- the long (64-bit) value
- Throws:
IOException- will be propagated back to the callerEndianUtils.BufferUnderrunException- if the stream cannot provide enough bytes
-
readLongBE
public static long readLongBE(InputStream stream) throws IOException, EndianUtils.BufferUnderrunException Deprecated.Get a NE long value from an InputStream- Parameters:
stream- the InputStream from which the long is to be read- Returns:
- the long (64-bit) value
- Throws:
IOException- will be propagated back to the callerEndianUtils.BufferUnderrunException- if the stream cannot provide enough bytes
-
readUE7
Deprecated.Gets the integer value that is stored in UTF-8 like fashion, in Big Endian but with the high bit on each number indicating if it continues or not- Throws:
IOException
-
getShortLE
public static short getShortLE(byte[] data) Deprecated.Get a LE short value from the beginning of a byte array- Parameters:
data- the byte array- Returns:
- the short (16-bit) value
-
getShortLE
public static short getShortLE(byte[] data, int offset) Deprecated.Get a LE short value from a byte array- Parameters:
data- the byte arrayoffset- a starting offset into the byte array- Returns:
- the short (16-bit) value
-
getUShortLE
public static int getUShortLE(byte[] data) Deprecated.Get a LE unsigned short value from the beginning of a byte array- Parameters:
data- the byte array- Returns:
- the unsigned short (16-bit) value in an int
-
getUShortLE
public static int getUShortLE(byte[] data, int offset) Deprecated.Get a LE unsigned short value from a byte array- Parameters:
data- the byte arrayoffset- a starting offset into the byte array- Returns:
- the unsigned short (16-bit) value in an integer
-
getShortBE
public static short getShortBE(byte[] data) Deprecated.Get a BE short value from the beginning of a byte array- Parameters:
data- the byte array- Returns:
- the short (16-bit) value
-
getShortBE
public static short getShortBE(byte[] data, int offset) Deprecated.Get a BE short value from a byte array- Parameters:
data- the byte arrayoffset- a starting offset into the byte array- Returns:
- the short (16-bit) value
-
getUShortBE
public static int getUShortBE(byte[] data) Deprecated.Get a BE unsigned short value from the beginning of a byte array- Parameters:
data- the byte array- Returns:
- the unsigned short (16-bit) value in an int
-
getUShortBE
public static int getUShortBE(byte[] data, int offset) Deprecated.Get a BE unsigned short value from a byte array- Parameters:
data- the byte arrayoffset- a starting offset into the byte array- Returns:
- the unsigned short (16-bit) value in an integer
-
getIntLE
public static int getIntLE(byte[] data) Deprecated.Get a LE int value from the beginning of a byte array- Parameters:
data- the byte array- Returns:
- the int (32-bit) value
-
getIntLE
public static int getIntLE(byte[] data, int offset) Deprecated.Get a LE int value from a byte array- Parameters:
data- the byte arrayoffset- a starting offset into the byte array- Returns:
- the int (32-bit) value
-
getIntBE
public static int getIntBE(byte[] data) Deprecated.Get a BE int value from the beginning of a byte array- Parameters:
data- the byte array- Returns:
- the int (32-bit) value
-
getIntBE
public static int getIntBE(byte[] data, int offset) Deprecated.Get a BE int value from a byte array- Parameters:
data- the byte arrayoffset- a starting offset into the byte array- Returns:
- the int (32-bit) value
-
getUIntLE
public static long getUIntLE(byte[] data) Deprecated.Get a LE unsigned int value from a byte array- Parameters:
data- the byte array- Returns:
- the unsigned int (32-bit) value in a long
-
getUIntLE
public static long getUIntLE(byte[] data, int offset) Deprecated.Get a LE unsigned int value from a byte array- Parameters:
data- the byte arrayoffset- a starting offset into the byte array- Returns:
- the unsigned int (32-bit) value in a long
-
getUIntBE
public static long getUIntBE(byte[] data) Deprecated.Get a BE unsigned int value from a byte array- Parameters:
data- the byte array- Returns:
- the unsigned int (32-bit) value in a long
-
getUIntBE
public static long getUIntBE(byte[] data, int offset) Deprecated.Get a BE unsigned int value from a byte array- Parameters:
data- the byte arrayoffset- a starting offset into the byte array- Returns:
- the unsigned int (32-bit) value in a long
-
getLongLE
public static long getLongLE(byte[] data, int offset) Deprecated.Get a LE long value from a byte array- Parameters:
data- the byte arrayoffset- a starting offset into the byte array- Returns:
- the long (64-bit) value
-
ubyteToInt
public static int ubyteToInt(byte b) Deprecated.Convert an 'unsigned' byte to an integer. ie, don't carry across the sign.- Parameters:
b- Description of the Parameter- Returns:
- Description of the Return Value
-
getUByte
public static short getUByte(byte[] data, int offset) Deprecated.get the unsigned value of a byte.- Parameters:
data- the byte array.offset- a starting offset into the byte array.- Returns:
- the unsigned value of the byte as a 16 bit short
-