|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectorg.h2.store.Data
public class Data
This class represents a byte buffer that contains persistent data of a page.
| Field Summary | |
|---|---|
static int |
LENGTH_INT
The length of an integer value. |
| Method Summary | |
|---|---|
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(DataHandler handler,
byte[] buff)
Create a new buffer using the given data for the given handler. |
static Data |
create(DataHandler handler,
int capacity)
Create a new buffer for the given handler. |
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. |
DataHandler |
getHandler()
|
static int |
getStringLen(java.lang.String s)
Get the length of a String. |
int |
getValueLen(Value v)
Calculate the number of bytes required to encode the given value. |
static int |
getVarLongLen(long x)
The number of bytes required for a variable size long. |
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. |
long |
readLong()
Read a long value. |
short |
readShortInt()
Read an short integer at the current position. |
java.lang.String |
readString()
Read a String value. |
Value |
readValue()
Read a value. |
int |
readVarInt()
Read a variable size int. |
long |
readVarLong()
Read a variable size long. |
void |
reset()
Set the position to 0. |
void |
setInt(int pos,
int x)
Update an integer at the given position. |
void |
setPos(int pos)
Set the current read / write position. |
void |
truncate(int size)
Shrink the array to this size. |
void |
write(byte[] buff,
int off,
int len)
Append a number of bytes to this buffer. |
void |
writeByte(byte x)
Append one single byte. |
void |
writeInt(int x)
Write an integer at the current position. |
void |
writeLong(long x)
Append a long value. |
void |
writeShortInt(int x)
Write a short integer at the current position. |
void |
writeString(java.lang.String s)
Write a String. |
void |
writeValue(Value v)
Append a value. |
void |
writeVarInt(int x)
Write a variable size int. |
void |
writeVarLong(long x)
Write a variable size long. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int LENGTH_INT
| Method Detail |
|---|
public void setInt(int pos,
int x)
pos - the positionx - the valuepublic void writeInt(int x)
x - the valuepublic int readInt()
public static int getStringLen(java.lang.String s)
s - the string
public java.lang.String readString()
public void writeString(java.lang.String s)
s - the value
public static Data create(DataHandler handler,
int capacity)
handler - the data handlercapacity - the initial capacity of the buffer
public static Data create(DataHandler handler,
byte[] buff)
handler - the data handlerbuff - the data
public 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 bytes
public 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 writeByte(byte x)
x - the valuepublic byte readByte()
public long readLong()
public void writeLong(long x)
x - the valuepublic void writeValue(Value v)
v - the valuepublic Value readValue()
public int getValueLen(Value v)
v - the value
public void setPos(int pos)
pos - the new positionpublic void writeShortInt(int x)
x - the valuepublic short readShortInt()
public void truncate(int size)
size - the new sizepublic void writeVarInt(int x)
x - the valuepublic int readVarInt()
public static int getVarLongLen(long x)
x - the value
public void writeVarLong(long x)
x - the valuepublic long readVarLong()
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 stream
java.io.IOExceptionpublic DataHandler getHandler()
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||