public class ByteArrayReader
extends java.io.ByteArrayInputStream
Utiltiy class to read common parameter types from a byte array.
| Modifier and Type | Field and Description |
|---|---|
static boolean |
encode |
| 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 |
close() |
static java.lang.String |
decodeString(byte[] data) |
void |
dispose() |
static java.lang.String |
getCharsetEncoding()
Get the current encoding being used for Strings variables.
|
int |
getPosition()
Get the current position within the array.
|
java.math.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.
|
java.math.BigInteger |
readMPINT()
Reads a standard SSH1 MPINT using the first 16 bits as the length prefix
|
java.math.BigInteger |
readMPINT32()
Reads an MPINT using the first 32 bits as the length prefix
|
short |
readShort() |
static short |
readShort(byte[] data,
int start) |
java.lang.String |
readString()
Read a String from the array.
|
java.lang.String |
readString(java.lang.String charset)
Read a String from the array converting using the given character set.
|
UnsignedInteger32 |
readUINT32() |
UnsignedInteger64 |
readUINT64() |
static void |
setCharsetEncoding(java.lang.String charset)
Allows the default encoding to be overriden for String variables processed
by the class.
|
void |
silentClose() |
public ByteArrayReader(byte[] buffer,
int start,
int len)
buffer - start - len - public ByteArrayReader(byte[] buffer)
public byte[] array()
public static void setCharsetEncoding(java.lang.String charset)
charset - java.io.UnsupportedEncodingExceptionpublic static java.lang.String getCharsetEncoding()
public void readFully(byte[] b,
int off,
int len)
throws java.io.IOException
b - off - len - java.io.IOExceptionpublic boolean readBoolean()
throws java.io.IOException
b - java.io.IOExceptionpublic void readFully(byte[] b)
throws java.io.IOException
java.io.IOExceptionpublic java.math.BigInteger readBigInteger()
throws java.io.IOException
java.io.IOExceptionpublic UnsignedInteger64 readUINT64() throws java.io.IOException
java.io.IOExceptionpublic UnsignedInteger32 readUINT32() throws java.io.IOException
java.io.IOExceptionpublic static long readInt(byte[] data,
int start)
data - start - public static short readShort(byte[] data,
int start)
public byte[] readBinaryString()
throws java.io.IOException
java.io.IOExceptionpublic long readInt()
throws java.io.IOException
java.io.IOExceptionpublic java.lang.String readString()
throws java.io.IOException
java.io.IOExceptionpublic java.lang.String readString(java.lang.String charset)
throws java.io.IOException
charset - java.io.IOExceptionpublic short readShort()
throws java.io.IOException
java.io.IOExceptionpublic java.math.BigInteger readMPINT32()
throws java.io.IOException
java.io.IOExceptionpublic java.math.BigInteger readMPINT()
throws java.io.IOException
java.io.IOExceptionpublic int getPosition()
public void silentClose()
public void dispose()
public void close()
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.ByteArrayInputStreampublic static java.lang.String decodeString(byte[] data)
throws java.io.IOException
java.io.IOExceptionCopyright © 2022. All rights reserved.