@Internal public final class LittleEndian extends java.lang.Object implements LittleEndianConsts
Modifier and Type | Class and Description |
---|---|
static class |
LittleEndian.BufferUnderrunException
Exception to handle buffer underruns
(处理缓冲区不足的异常)
|
BYTE_SIZE, DOUBLE_SIZE, INT_SIZE, LONG_SIZE, SHORT_SIZE
Modifier and Type | Method and Description |
---|---|
static double |
getDouble(byte[] data)
get a double value from a byte array, reads it in little endian format then converts the resulting revolting IEEE 754 (curse them) floating point number to a happy java double
(从字节数组中获取双精度值,以小端格式读取它,然后将生成的令人反感的 IEEE 754(诅咒它们)浮点数转换为快乐的 java 双精度)
|
static double |
getDouble(byte[] data, int offset)
get a double value from a byte array, reads it in little endian format then converts the resulting revolting IEEE 754 (curse them) floating point number to a happy java double
(从字节数组中获取双精度值,以小端格式读取它,然后将生成的令人反感的 IEEE 754(诅咒它们)浮点数转换为快乐的 java 双精度)
|
static float |
getFloat(byte[] data)
get a float value from a byte array, reads it in little endian format then converts the resulting revolting IEEE 754 (curse them) floating point number to a happy java float
(从字节数组中获取浮点值,以小端格式读取它,然后将生成的令人反感的 IEEE 754(诅咒它们)浮点数转换为快乐的 java 浮点数)
|
static float |
getFloat(byte[] data, int offset)
get a float value from a byte array, reads it in little endian format then converts the resulting revolting IEEE 754 (curse them) floating point number to a happy java float
(从字节数组中获取浮点值,以小端格式读取它,然后将生成的令人反感的 IEEE 754(诅咒它们)浮点数转换为快乐的 java 浮点数)
|
static int |
getInt(byte[] data)
get an int value from the beginning of a byte array
(从字节数组的开头获取一个 int 值)
|
static int |
getInt(byte[] data, int offset)
get an int value from a byte array
(从字节数组中获取一个 int 值)
|
static long |
getLong(byte[] data)
get a long value from a byte array
(从字节数组中获取长值)
|
static long |
getLong(byte[] data, int offset)
get a long value from a byte array
(从字节数组中获取长值)
|
static short |
getShort(byte[] data)
get a short value from the beginning of a byte array
(从字节数组的开头获取一个短值)
|
static short |
getShort(byte[] data, int offset)
get a short value from a byte array
(从字节数组中获取一个短值)
|
static short[] |
getShortArray(byte[] data, int offset, int size)
Read short array
(读取短数组)
|
static short |
getUByte(byte[] data)
get the unsigned value of a byte.
(获取一个字节的无符号值。)
|
static short |
getUByte(byte[] data, int offset)
get the unsigned value of a byte.
(获取一个字节的无符号值。)
|
static long |
getUInt(byte[] data)
get an unsigned int value from a byte array
(从字节数组中获取一个无符号整数值)
|
static long |
getUInt(byte[] data, int offset)
get an unsigned int value from a byte array
(从字节数组中获取一个无符号整数值)
|
static int |
getUShort(byte[] data)
get an unsigned short value from the beginning of a byte array
(从字节数组的开头获取一个无符号短值)
|
static int |
getUShort(byte[] data, int offset)
get an unsigned short value from a byte array
(从字节数组中获取无符号短值)
|
static void |
putByte(byte[] data, int offset, int value)
executes:
(执行:)
|
static void |
putDouble(byte[] data, int offset, double value)
put a double value into a byte array
(将双精度值放入字节数组)
|
static void |
putDouble(double value, java.io.OutputStream outputStream)
put a double value into a byte array
(将双精度值放入字节数组)
|
static void |
putFloat(byte[] data, int offset, float value)
put a float value into a byte array
(将浮点值放入字节数组)
|
static void |
putFloat(float value, java.io.OutputStream outputStream)
put a float value into a byte array
(将浮点值放入字节数组)
|
static void |
putInt(byte[] data, int offset, int value)
put an int value into a byte array
(将一个 int 值放入一个字节数组中)
|
static void |
putInt(int value, java.io.OutputStream outputStream)
Put int into output stream
(将 int 放入输出流)
|
static void |
putLong(byte[] data, int offset, long value)
put a long value into a byte array
(将长值放入字节数组)
|
static void |
putLong(long value, java.io.OutputStream outputStream)
Put long into output stream
(将 long 放入输出流)
|
static void |
putShort(byte[] data, int offset, short value)
put a short value into a byte array
(将一个短值放入字节数组)
|
static void |
putShort(java.io.OutputStream outputStream, short value)
Put signed short into output stream
(将带符号的short放入输出流)
|
static void |
putShortArray(byte[] data, int startOffset, short[] value)
Stores short array in buffer
(将短数组存储在缓冲区中)
|
static void |
putUByte(byte[] data, int offset, short value)
put an unsigned byte value into a byte array
(将无符号字节值放入字节数组)
|
static void |
putUInt(byte[] data, int offset, long value)
put an unsigned int value into a byte array
(将无符号整数值放入字节数组)
|
static void |
putUInt(long value, java.io.OutputStream outputStream)
Put unsigned int into output stream
(将 unsigned int 放入输出流)
|
static void |
putUShort(byte[] data, int offset, int value)
put an unsigned short value into a byte array
(将无符号短值放入字节数组)
|
static void |
putUShort(int value, java.io.OutputStream outputStream)
Put unsigned short into output stream
(将 unsigned short 放入输出流)
|
static int |
readInt(java.io.InputStream stream)
get an int value from an InputStream
(从 InputStream 中获取一个 int 值)
|
static long |
readLong(java.io.InputStream stream)
get a long value from an InputStream
(从 InputStream 中获取长值)
|
static short |
readShort(java.io.InputStream stream)
get a short value from an InputStream
(从 InputStream 中获取一个短值)
|
static long |
readUInt(java.io.InputStream stream)
get an unsigned int value from an InputStream
(从 InputStream 获取无符号整数值)
|
static int |
readUShort(java.io.InputStream stream) |
static int |
ubyteToInt(byte b)
Convert an 'unsigned' byte to an integer.
(将“无符号”字节转换为整数。)
|
public static double getDouble(byte[] data)
data
- the byte array
(data - 字节数组)
public static double getDouble(byte[] data, int offset)
data
- the byte array
(data - 字节数组)
offset
- a starting offset into the byte array
(offset - 字节数组的起始偏移量)
public static float getFloat(byte[] data)
data
- the byte array
(data - 字节数组)
public static float getFloat(byte[] data, int offset)
data
- the byte array
(data - 字节数组)
offset
- a starting offset into the byte array
(offset - 字节数组的起始偏移量)
public static int getInt(byte[] data)
data
- the byte array
(data - 字节数组)
public static int getInt(byte[] data, int offset)
data
- the byte array
(data - 字节数组)
offset
- a starting offset into the byte array
(offset - 字节数组的起始偏移量)
public static long getLong(byte[] data)
data
- the byte array
(data - 字节数组)
public static long getLong(byte[] data, int offset)
data
- the byte array
(data - 字节数组)
offset
- a starting offset into the byte array
(offset - 字节数组的起始偏移量)
public static short getShort(byte[] data)
data
- the byte array
(data - 字节数组)
public static short getShort(byte[] data, int offset)
data
- the byte array
(data - 字节数组)
offset
- a starting offset into the byte array
(offset - 字节数组的起始偏移量)
public static short[] getShortArray(byte[] data, int offset, int size)
data
- the original byte array
(data - 原始字节数组)
offset
- Where to start copying from.
(offset - 从哪里开始复制。)
size
- Number of bytes to copy.
(size - 要复制的字节数。)
java.lang.IndexOutOfBoundsException
- - if read would cause access of data outside array bounds.
(java.lang.IndexOutOfBoundsException - - 如果读取会导致访问数组边界之外的数据。)
public static short getUByte(byte[] data)
data
- the byte array.
(data - 字节数组。)
public static short getUByte(byte[] data, int offset)
data
- the byte array.
(data - 字节数组。)
offset
- a starting offset into the byte array.
(offset - 字节数组的起始偏移量。)
public static long getUInt(byte[] data)
data
- the byte array
(data - 字节数组)
public static long getUInt(byte[] data, int offset)
data
- the byte array
(data - 字节数组)
offset
- a starting offset into the byte array
(offset - 字节数组的起始偏移量)
public static int getUShort(byte[] data)
data
- the byte array
(data - 字节数组)
public static int getUShort(byte[] data, int offset)
data
- the byte array
(data - 字节数组)
offset
- a starting offset into the byte array
(offset - 字节数组的起始偏移量)
public static void putByte(byte[] data, int offset, int value)
data[offset] = (byte)value;
public static void putDouble(byte[] data, int offset, double value)
data
- the byte array
(data - 字节数组)
offset
- a starting offset into the byte array
(offset - 字节数组的起始偏移量)
value
- the double (64-bit) value
(value - 双精度(64 位)值)
public static void putDouble(double value, java.io.OutputStream outputStream) throws java.io.IOException
value
- the double (64-bit) value
(value - 双精度(64 位)值)
outputStream
- output stream
(outputStream - 输出流)
java.io.IOException
- if an I/O error occurs
(java.io.IOException - 如果发生 I/O 错误)
public static void putFloat(byte[] data, int offset, float value)
data
- the byte array
(data - 字节数组)
offset
- a starting offset into the byte array
(offset - 字节数组的起始偏移量)
value
- the float (32-bit) value
(value - 浮点(32 位)值)
public static void putFloat(float value, java.io.OutputStream outputStream) throws java.io.IOException
value
- the float (32-bit) value
(value - 浮点(32 位)值)
outputStream
- output stream
(outputStream - 输出流)
java.io.IOException
- if an I/O error occurs
(java.io.IOException - 如果发生 I/O 错误)
public static void putInt(byte[] data, int offset, int value)
data
- the byte array
(data - 字节数组)
offset
- a starting offset into the byte array
(offset - 字节数组的起始偏移量)
value
- the int (32-bit) value
(value - int(32 位)值)
public static void putInt(int value, java.io.OutputStream outputStream) throws java.io.IOException
value
- the int (32-bit) value
(value - int(32 位)值)
outputStream
- output stream
(outputStream - 输出流)
java.io.IOException
- if an I/O error occurs
(java.io.IOException - 如果发生 I/O 错误)
public static void putLong(byte[] data, int offset, long value)
data
- the byte array
(data - 字节数组)
offset
- a starting offset into the byte array
(offset - 字节数组的起始偏移量)
value
- the long (64-bit) value
(value - 长(64 位)值)
public static void putLong(long value, java.io.OutputStream outputStream) throws java.io.IOException
value
- the long (64-bit) value
(value - 长(64 位)值)
outputStream
- output stream
(outputStream - 输出流)
java.io.IOException
- if an I/O error occurs
(java.io.IOException - 如果发生 I/O 错误)
public static void putShort(byte[] data, int offset, short value)
data
- the byte array
(data - 字节数组)
offset
- a starting offset into the byte array
(offset - 字节数组的起始偏移量)
value
- the short (16-bit) value
(value - 短(16 位)值)
public static void putShort(java.io.OutputStream outputStream, short value) throws java.io.IOException
value
- the short (16-bit) value
(value - 短(16 位)值)
outputStream
- output stream
(outputStream - 输出流)
java.io.IOException
- if an I/O error occurs
(java.io.IOException - 如果发生 I/O 错误)
public static void putShortArray(byte[] data, int startOffset, short[] value)
data
- the byte array
(data - 字节数组)
startOffset
- a starting offset into the byte array
(startOffset - 字节数组的起始偏移量)
value
- the short (16-bit) values
(value - 短(16 位)值)
public static void putUByte(byte[] data, int offset, short value)
data
- the byte array
(data - 字节数组)
offset
- a starting offset into the byte array
(offset - 字节数组的起始偏移量)
value
- the short (16-bit) value
(value - 短(16 位)值)
java.lang.ArrayIndexOutOfBoundsException
- may be thrown
(java.lang.ArrayIndexOutOfBoundsException - 可能被抛出)
public static void putUInt(byte[] data, int offset, long value)
data
- the byte array
(data - 字节数组)
offset
- a starting offset into the byte array
(offset - 字节数组的起始偏移量)
value
- the int (32-bit) value
(value - int(32 位)值)
java.lang.ArrayIndexOutOfBoundsException
- may be thrown
(java.lang.ArrayIndexOutOfBoundsException - 可能被抛出)
public static void putUInt(long value, java.io.OutputStream outputStream) throws java.io.IOException
value
- the int (32-bit) value
(value - int(32 位)值)
outputStream
- output stream
(outputStream - 输出流)
java.io.IOException
- if an I/O error occurs
(java.io.IOException - 如果发生 I/O 错误)
public static void putUShort(byte[] data, int offset, int value)
data
- the byte array
(data - 字节数组)
offset
- a starting offset into the byte array
(offset - 字节数组的起始偏移量)
value
- the short (16-bit) value
(value - 短(16 位)值)
java.lang.ArrayIndexOutOfBoundsException
- may be thrown
(java.lang.ArrayIndexOutOfBoundsException - 可能被抛出)
public static void putUShort(int value, java.io.OutputStream outputStream) throws java.io.IOException
value
- the unsigned short (16-bit) value
(value - 无符号短(16 位)值)
outputStream
- output stream
(outputStream - 输出流)
java.io.IOException
- if an I/O error occurs
(java.io.IOException - 如果发生 I/O 错误)
public static int readInt(java.io.InputStream stream) throws java.io.IOException
stream
- the InputStream from which the int is to be read
(stream - 要从中读取 int 的 InputStream)
java.io.IOException
- will be propagated back to the caller
(java.io.IOException - 将传播回调用者)
LittleEndian.BufferUnderrunException
- if the stream cannot provide enough bytes
(LittleEndian.BufferUnderrunException - 如果流无法提供足够的字节)
public static long readUInt(java.io.InputStream stream) throws java.io.IOException
stream
- the InputStream from which the int is to be read
(stream - 要从中读取 int 的 InputStream)
java.io.IOException
- will be propagated back to the caller
(java.io.IOException - 将传播回调用者)
LittleEndian.BufferUnderrunException
- if the stream cannot provide enough bytes
(LittleEndian.BufferUnderrunException - 如果流无法提供足够的字节)
public static long readLong(java.io.InputStream stream) throws java.io.IOException
stream
- the InputStream from which the long is to be read
(stream - 要从中读取 long 的 InputStream)
java.io.IOException
- will be propagated back to the caller
(java.io.IOException - 将传播回调用者)
LittleEndian.BufferUnderrunException
- if the stream cannot provide enough bytes
(LittleEndian.BufferUnderrunException - 如果流无法提供足够的字节)
public static short readShort(java.io.InputStream stream) throws java.io.IOException
stream
- the InputStream from which the short is to be read
(stream - 要从中读取短的 InputStream)
java.io.IOException
- will be propagated back to the caller
(java.io.IOException - 将传播回调用者)
LittleEndian.BufferUnderrunException
- if the stream cannot provide enough bytes
(LittleEndian.BufferUnderrunException - 如果流无法提供足够的字节)
public static int readUShort(java.io.InputStream stream) throws java.io.IOException
java.io.IOException
(java.io.IOException)
public static int ubyteToInt(byte b)
b
- Description of the Parameter
(b - 参数说明)
Copyright 2021 The Apache Software Foundation or its licensors, as applicable.