public class ArrayWriter extends Object
Represents a byte array data writer.
Constructor and Description |
---|
ArrayWriter(byte[] array)
Initializes a new instance of the
ArrayWriter class. |
Modifier and Type | Method and Description |
---|---|
void |
checkIndex()
Throws an exception if writing index is not equal to the length of the array.
|
byte[] |
getArray()
Gets the byte array.
|
int |
getIndex()
Gets the current writing position.
|
void |
write(boolean value)
Writes a boolean value to the array.
|
void |
write(byte value)
Writes a byte value to the array.
|
void |
write(char value)
Writes a char value to the array.
|
void |
write(double value)
Writes a double value to the array.
|
void |
write(int value)
Writes an int value to the array.
|
void |
write(long value)
Writes a long value to the array.
|
void |
write(String value)
Writes a String value to the array.
|
public ArrayWriter(byte[] array)
Initializes a new instance of the ArrayWriter
class.
array
- The byte array to write to.public final byte[] getArray()
Gets the byte array.
public final int getIndex()
Gets the current writing position.
public final void checkIndex()
Throws an exception if writing index is not equal to the length of the array.
public final void write(byte value)
Writes a byte value to the array.
value
- The value to write to the array.public final void write(boolean value)
Writes a boolean value to the array.
value
- The value to write to the array.public final void write(char value)
Writes a char value to the array.
value
- The value to write to the array.public final void write(int value)
Writes an int value to the array.
value
- The value to write to the array.public final void write(long value)
Writes a long value to the array.
value
- The value to write to the array.public final void write(double value)
Writes a double value to the array.
value
- The value to write to the array.public final void write(String value)
Writes a String value to the array.
value
- The value to write to the array.