public class ByteBuffer
extends java.lang.Object
| Constructor | Description |
|---|---|
ByteBuffer(byte[] buffer) |
|
ByteBuffer(byte[] buffer,
int length) |
|
ByteBuffer(byte[] buffer,
int offset,
int length) |
|
ByteBuffer(int initialCapacity) |
|
ByteBuffer(java.io.InputStream in) |
Loads the stream into a buffer.
|
| Modifier and Type | Method | 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) |
|
java.io.InputStream |
getByteStream() |
|
java.lang.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(java.io.InputStream in)
throws java.io.IOException
in - an InputStreamjava.io.IOException - 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 java.io.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 java.lang.String getEncoding()
Copyright © 1998–2018. All rights reserved.