public class ByteBuffer extends Object
| Constructor and Description |
|---|
ByteBuffer(byte[] buffer) |
ByteBuffer(byte[] buffer,
int length) |
ByteBuffer(byte[] buffer,
int offset,
int length) |
ByteBuffer(InputStream in)
Loads the stream into a buffer.
|
ByteBuffer(int initialCapacity) |
| Modifier and Type | Method and Description |
|---|---|
void |
append(byte b)
Appends a byte to the buffer.
|
void |
append(byte[] bytes)
Append a byte array to the buffer
|
void |
append(byte[] bytes,
int offset,
int len)
Appends a byte array or part of to the buffer.
|
void |
append(ByteBuffer anotherBuffer)
Append another buffer to this buffer.
|
byte |
byteAt(int index) |
int |
charAt(int index) |
InputStream |
getByteStream() |
String |
getEncoding()
Detects the encoding of the byte buffer, stores and returns it.
|
int |
length() |
public ByteBuffer(int initialCapacity)
initialCapacity - the initial capacity for this bufferpublic ByteBuffer(byte[] buffer)
buffer - a byte array that will be wrapped with ByteBuffer.public ByteBuffer(byte[] buffer,
int length)
buffer - a byte array that will be wrapped with ByteBuffer.length - the length of valid bytes in the arraypublic ByteBuffer(InputStream in) throws IOException
in - an InputStreamIOException - If the stream cannot be read.public ByteBuffer(byte[] buffer,
int offset,
int length)
buffer - a byte array that will be wrapped with ByteBuffer.offset - the offset of the provided buffer.length - the length of valid bytes in the arraypublic InputStream getByteStream()
public int length()
public byte byteAt(int index)
index - the index to retrieve the byte frompublic int charAt(int index)
index - the index to retrieve a byte as int or char.public void append(byte b)
b - a bytepublic void append(byte[] bytes,
int offset,
int len)
bytes - a byte arrayoffset - an offset withlen - public void append(byte[] bytes)
bytes - a byte arraypublic void append(ByteBuffer anotherBuffer)
anotherBuffer - another ByteBufferpublic String getEncoding()
Copyright © 2015–2020 The veraPDF Consortium. All rights reserved.