@ThreadSafe public final class ByteIOUtils extends Object
Modifier and Type | Method and Description |
---|---|
static byte |
readByte(byte[] buf,
int pos)
Reads a specific byte value from the input byte array at the given offset.
|
static byte |
readByte(ByteBuffer buf,
int pos)
Reads a specific byte value from the input byte buffer at the given offset.
|
static int |
readInt(byte[] buf,
int pos)
Reads a specific integer byte value (4 bytes) from the input byte array at the given offset.
|
static int |
readInt(ByteBuffer buf,
int pos)
Reads a specific integer byte value (4 bytes) from the input byte buffer at the given offset.
|
static long |
readLong(byte[] buf,
int pos)
Reads a specific long byte value (8 bytes) from the input byte array at the given offset.
|
static short |
readShort(byte[] buf,
int pos)
Reads a specific short byte value (2 bytes) from the input byte array at the given offset.
|
static void |
writeByte(byte[] buf,
int pos,
byte v)
Writes a single byte value (1 byte) to the output byte array at the given offset.
|
static void |
writeByte(ByteBuffer buf,
int pos,
byte v)
Writes a single byte value (1 byte) to the output byte buffer at the given offset.
|
static void |
writeByte(OutputStream out,
byte v)
Writes a single byte value (1 byte) to the output stream.
|
static void |
writeInt(byte[] buf,
int pos,
int v)
Writes a specific integer value (4 bytes) to the output byte array at the given offset.
|
static void |
writeInt(ByteBuffer buf,
int pos,
int v)
Writes a specific integer value (4 bytes) to the output byte buffer at the given offset.
|
static void |
writeInt(OutputStream out,
int v)
Writes a specific integer value (4 bytes) to the output stream.
|
static void |
writeLong(byte[] buf,
int pos,
long v)
Writes a specific long value (8 bytes) to the output byte array at the given offset.
|
static void |
writeLong(OutputStream out,
long v)
Writes a specific long value (8 bytes) to the output stream.
|
static void |
writeShort(byte[] buf,
int pos,
short v)
Writes a specific short value (2 bytes) to the output byte buffer at the given offset.
|
static void |
writeShort(OutputStream out,
short v)
Writes a specific short value (2 bytes) to the output stream.
|
public static byte readByte(byte[] buf, int pos)
buf
- input byte arraypos
- offset into the byte buffer to readpublic static byte readByte(ByteBuffer buf, int pos)
buf
- input byte bufferpos
- offset into the byte buffer to readpublic static short readShort(byte[] buf, int pos)
buf
- input byte bufferpos
- offset into the byte buffer to readpublic static int readInt(byte[] buf, int pos)
buf
- input byte arraypos
- offset into the byte buffer to readpublic static int readInt(ByteBuffer buf, int pos)
buf
- input byte bufferpos
- offset into the byte buffer to readpublic static long readLong(byte[] buf, int pos)
buf
- input byte bufferpos
- offset into the byte buffer to readpublic static void writeByte(byte[] buf, int pos, byte v)
buf
- output byte bufferpos
- offset into the byte buffer to writev
- byte value to writepublic static void writeByte(ByteBuffer buf, int pos, byte v)
buf
- output byte bufferpos
- offset into the byte buffer to writev
- byte value to writepublic static void writeByte(OutputStream out, byte v) throws IOException
OutputStream.write(int)
.out
- output streamv
- byte value to writeIOException
public static void writeShort(byte[] buf, int pos, short v)
buf
- output byte bufferpos
- offset into the byte buffer to writev
- short value to writepublic static void writeShort(OutputStream out, short v) throws IOException
out
- output streamv
- short value to writeIOException
public static void writeInt(byte[] buf, int pos, int v)
buf
- output byte arraypos
- offset into the byte buffer to writev
- int value to writepublic static void writeInt(ByteBuffer buf, int pos, int v)
buf
- output byte bufferpos
- offset into the byte buffer to writev
- int value to writepublic static void writeInt(OutputStream out, int v) throws IOException
out
- output streamv
- integer value to writeIOException
public static void writeLong(byte[] buf, int pos, long v)
buf
- output byte arraypos
- offset into the byte buffer to writev
- long value to writepublic static void writeLong(OutputStream out, long v) throws IOException
out
- output streamv
- long value to writeIOException
Copyright © 2023. All Rights Reserved.