public class ByteArrayReader extends ByteArrayInputStream
Utiltiy class to read common parameter types from a byte array.
| Modifier and Type | Field and Description |
|---|---|
static boolean |
encode |
buf, count, mark, pos| Constructor and Description |
|---|
ByteArrayReader(byte[] buffer) |
ByteArrayReader(byte[] buffer,
int start,
int len)
Construct a reader.
|
| Modifier and Type | Method and Description |
|---|---|
byte[] |
array()
Provides access to the underlying array
|
void |
dispose() |
static String |
getCharsetEncoding()
Get the current encoding being used for Strings variables.
|
int |
getPosition()
Get the current position within the array.
|
BigInteger |
readBigInteger()
Read a BigInteger from the array.
|
byte[] |
readBinaryString()
Read a binary string from the array.
|
boolean |
readBoolean()
Write a boolean value to the array.
|
void |
readFully(byte[] b) |
void |
readFully(byte[] b,
int off,
int len)
Read until the buffer supplied is full.
|
long |
readInt()
Read an integer (4 bytes) from the array.
|
static long |
readInt(byte[] data,
int start)
Read an integer (4 bytes) from the array.
|
BigInteger |
readMPINT()
Reads a standard SSH1 MPINT using the first 16 bits as the length prefix
|
BigInteger |
readMPINT32()
Reads an MPINT using the first 32 bits as the length prefix
|
short |
readShort() |
static short |
readShort(byte[] data,
int start) |
String |
readString()
Read a String from the array.
|
String |
readString(String charset)
Read a String from the array converting using the given character set.
|
UnsignedInteger32 |
readUINT32() |
UnsignedInteger64 |
readUINT64() |
static void |
setCharsetEncoding(String charset)
Allows the default encoding to be overriden for String variables processed
by the class.
|
void |
silentClose() |
available, close, mark, markSupported, read, read, reset, skipreadpublic ByteArrayReader(byte[] buffer,
int start,
int len)
buffer - start - len - public ByteArrayReader(byte[] buffer)
public byte[] array()
public static void setCharsetEncoding(String charset)
charset - UnsupportedEncodingExceptionpublic static String getCharsetEncoding()
public void readFully(byte[] b,
int off,
int len)
throws IOException
b - off - len - IOExceptionpublic boolean readBoolean()
throws IOException
b - IOExceptionpublic void readFully(byte[] b)
throws IOException
IOExceptionpublic BigInteger readBigInteger() throws IOException
IOExceptionpublic UnsignedInteger64 readUINT64() throws IOException
IOExceptionpublic UnsignedInteger32 readUINT32() throws IOException
IOExceptionpublic static long readInt(byte[] data,
int start)
data - start - public static short readShort(byte[] data,
int start)
public byte[] readBinaryString()
throws IOException
IOExceptionpublic long readInt()
throws IOException
IOExceptionpublic String readString() throws IOException
IOExceptionpublic String readString(String charset) throws IOException
charset - IOExceptionpublic short readShort()
throws IOException
IOExceptionpublic BigInteger readMPINT32() throws IOException
IOExceptionpublic BigInteger readMPINT() throws IOException
IOExceptionpublic int getPosition()
public void silentClose()
public void dispose()
Copyright © 2025. All rights reserved.