public class Data
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
void |
checkCapacity(int plus)
Check if there is still enough capacity in the buffer.
|
static void |
copyString(java.io.Reader source,
java.io.OutputStream target)
Copy a String from a reader to an output stream.
|
static Data |
create(int capacity)
Create a new buffer.
|
void |
fillAligned()
Fill up the buffer with empty space and an (initially empty) checksum
until the size is a multiple of Constants.FILE_BLOCK_SIZE.
|
byte[] |
getBytes()
Get the byte array used for this page.
|
int |
length()
Get the current write position of this buffer, which is the current
length.
|
void |
read(byte[] buff,
int off,
int len)
Copy a number of bytes to the given buffer from the current position.
|
byte |
readByte()
Read one single byte.
|
int |
readInt()
Read an integer at the current position.
|
void |
reset()
Set the position to 0.
|
void |
setPos(int pos)
Set the current read / write position.
|
void |
write(byte[] buff,
int off,
int len)
Append a number of bytes to this buffer.
|
void |
writeInt(int x)
Write an integer at the current position.
|
public void writeInt(int x)
x - the valuepublic int readInt()
public static Data create(int capacity)
capacity - the initial capacity of the bufferpublic int length()
public byte[] getBytes()
public void reset()
public void write(byte[] buff,
int off,
int len)
buff - the dataoff - the offset in the datalen - the length in bytespublic void read(byte[] buff,
int off,
int len)
buff - the output bufferoff - the offset in the output bufferlen - the number of bytes to copypublic void setPos(int pos)
pos - the new positionpublic byte readByte()
public void checkCapacity(int plus)
plus - the number of additional bytes requiredpublic void fillAligned()
public static void copyString(java.io.Reader source,
java.io.OutputStream target)
throws java.io.IOException
source - the readertarget - the output streamjava.io.IOException - on failure