public class Bytes
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
byte[] |
content
Byte array which can be reused
|
static Bytes |
EMPTY
Helper object for providing zero length object (instead of null object)
|
int |
length
Length which specifies valid data in array
|
| Constructor and Description |
|---|
Bytes(byte[] content,
int length)
Create a new instance of Bytes object by providing used array and length which indicates end of valid data.
|
| Modifier and Type | Method and Description |
|---|---|
void |
copyTo(java.io.OutputStream stream)
Copy bytes to output stream.
|
byte[] |
toByteArray()
Utility method for returning byte[] of the actual size.
|
java.lang.String |
toUtf8()
Utility method for displaying byte[] as UTF-8 string.
|
public final byte[] content
public final int length
public static final Bytes EMPTY
public Bytes(byte[] content,
int length)
content - datalength - actual length of arraypublic void copyTo(java.io.OutputStream stream)
throws java.io.IOException
stream - output streamjava.io.IOExceptionpublic java.lang.String toUtf8()
public byte[] toByteArray()