public final class Bytes extends 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(OutputStream stream)
Copy bytes to output stream.
|
static Bytes |
from(byte[] content) |
byte[] |
toByteArray()
Utility method for returning byte[] of the actual size.
|
ByteArrayInputStream |
toStream() |
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 static Bytes from(byte[] content)
public void copyTo(OutputStream stream) throws IOException
stream - output streamIOExceptionpublic ByteArrayInputStream toStream()
public String toUtf8()
public byte[] toByteArray()
Copyright © 2015. All rights reserved.