|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.h2.store.DataPage
org.h2.store.Data
public class Data
A data page is a byte buffer that contains persistent data of a page.
Field Summary |
---|
Fields inherited from class org.h2.store.DataPage |
---|
data, handler, LENGTH_FILLER, LENGTH_INT, LENGTH_LONG, pos |
Method Summary | |
---|---|
static Data |
create(DataHandler handler,
byte[] buff)
Create a new data page using the given data for the given handler. |
static Data |
create(DataHandler handler,
int capacity)
Create a new data page for the given handler. |
void |
fill(int len)
Increase the size to the given length. |
byte[] |
getBytes()
Get the byte array used for this page. |
int |
getStringLen(java.lang.String s)
Get the length of a String value. |
int |
getValueLen(Value v)
Calculate the number of bytes required to encode the given value. |
int |
getVarLongLen(long x)
The number of bytes required for a variable size long. |
int |
length()
Get the current write position of this data page, 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. |
int |
readByte()
Read one single byte. |
int |
readInt()
Read an integer at the current position. |
long |
readLong()
Read a long value. |
int |
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 data page. |
void |
writeByte(byte x)
Append one single byte. |
void |
writeDataPageNoSize(Data page)
Append the contents of the given data page to this page. |
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 value. |
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 org.h2.store.DataPage |
---|
check, checkCapacity, fillAligned, readDataPageNoSize, updateChecksum, writeDataPageNoSize |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public void setInt(int pos, int x)
setInt
in class DataPage
pos
- the positionx
- the valuepublic void writeInt(int x)
writeInt
in class DataPage
x
- the valuepublic int readInt()
readInt
in class DataPage
public int getStringLen(java.lang.String s)
getStringLen
in class DataPage
s
- the value
public java.lang.String readString()
readString
in class DataPage
public void writeString(java.lang.String s)
writeString
in class DataPage
s
- the valuepublic void fill(int len)
fill
in class DataPage
len
- the new lengthpublic 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()
length
in class DataPage
public byte[] getBytes()
getBytes
in class DataPage
public void reset()
reset
in class DataPage
public void writeDataPageNoSize(Data page)
page
- the page that will be appendedpublic void write(byte[] buff, int off, int len)
write
in class DataPage
buff
- the dataoff
- the offset in the datalen
- the length in bytespublic void read(byte[] buff, int off, int len)
read
in class DataPage
buff
- the output bufferoff
- the offset in the output bufferlen
- the number of bytes to copypublic void writeByte(byte x)
writeByte
in class DataPage
x
- the valuepublic int readByte()
readByte
in class DataPage
public long readLong()
readLong
in class DataPage
public void writeLong(long x)
writeLong
in class DataPage
x
- the valuepublic void writeValue(Value v) throws java.sql.SQLException
writeValue
in class DataPage
v
- the value
java.sql.SQLException
public Value readValue() throws java.sql.SQLException
readValue
in class DataPage
java.sql.SQLException
public int getValueLen(Value v) throws java.sql.SQLException
getValueLen
in class DataPage
v
- the value
java.sql.SQLException
public void setPos(int pos)
setPos
in class DataPage
pos
- the new positionpublic void writeShortInt(int x)
writeShortInt
in class DataPage
x
- the valuepublic int readShortInt()
readShortInt
in class DataPage
public void truncate(int size)
size
- the new sizepublic void writeVarInt(int x)
x
- the valuepublic int readVarInt()
public int getVarLongLen(long x)
x
- the value
public void writeVarLong(long x)
x
- the valuepublic long readVarLong()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |