org.neo4j.kernel.impl.nioneo.store
Class Buffer

java.lang.Object
  extended by org.neo4j.kernel.impl.nioneo.store.Buffer

public class Buffer
extends Object

Wraps a ByteBuffer and is tied to a PersistenceWindow. Using the setOffset(int) method one can offset the buffer (within the limits of the persistence window.

All the put and get methods of this class works the same way as in ByteBuffer.

See Also:
ByteBuffer, PersistenceWindow

Method Summary
 void close()
           
 byte get()
          Reads and returns a byte from the underlying buffer.
 Buffer get(byte[] dst)
          Reads byte array length bytes into the byte array from the underlying buffer.
 Buffer get(char[] dst)
           
 ByteBuffer getBuffer()
          Returns the underlying byte buffer.
 int getInt()
          Reads and returns a int from the underlying buffer.
 long getLong()
          Reads and returns a long from the underlying buffer.
 int getOffset()
          Returns the offset of this buffer.
 long getUnsignedInt()
           
 long position()
          Returns the position of the persistence window tied to this buffer.
 Buffer put(byte b)
          Puts a byte into the underlying buffer.
 Buffer put(byte[] src)
          Puts a byte array into the underlying buffer.
 Buffer put(byte[] src, int offset, int length)
          Puts a byte array into the underlying buffer starting from offset in the array and writing length values.
 Buffer put(char[] src)
           
 Buffer putInt(int i)
          Puts a int into the underlying buffer.
 Buffer putLong(long l)
          Puts a long into the underlying buffer.
 Buffer setOffset(int offset)
          Sets the offset from persistence window position in the underlying byte buffer.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

position

public long position()
Returns the position of the persistence window tied to this buffer.

Returns:
The persistence window's position

getBuffer

public ByteBuffer getBuffer()
Returns the underlying byte buffer.

Returns:
The byte buffer wrapped by this buffer

setOffset

public Buffer setOffset(int offset)
Sets the offset from persistence window position in the underlying byte buffer.

Parameters:
offset - The new offset to set
Returns:
This buffer

getOffset

public int getOffset()
Returns the offset of this buffer.

Returns:
The offset

put

public Buffer put(byte b)
Puts a byte into the underlying buffer.

Parameters:
b - The byte that will be written
Returns:
This buffer

putInt

public Buffer putInt(int i)
Puts a int into the underlying buffer.

Parameters:
i - The int that will be written
Returns:
This buffer

putLong

public Buffer putLong(long l)
Puts a long into the underlying buffer.

Parameters:
l - The long that will be written
Returns:
This buffer

get

public byte get()
Reads and returns a byte from the underlying buffer.

Returns:
The byte value at the current position/offset

getInt

public int getInt()
Reads and returns a int from the underlying buffer.

Returns:
The int value at the current position/offset

getUnsignedInt

public long getUnsignedInt()

getLong

public long getLong()
Reads and returns a long from the underlying buffer.

Returns:
The long value at the current position/offset

put

public Buffer put(byte[] src)
Puts a byte array into the underlying buffer.

Parameters:
src - The byte array that will be written
Returns:
This buffer

put

public Buffer put(char[] src)

put

public Buffer put(byte[] src,
                  int offset,
                  int length)
Puts a byte array into the underlying buffer starting from offset in the array and writing length values.

Parameters:
src - The byte array to write values from
offset - The offset in the byte array
length - The number of bytes to write
Returns:
This buffer

get

public Buffer get(byte[] dst)
Reads byte array length bytes into the byte array from the underlying buffer.

Parameters:
dst - The byte array to read values into
Returns:
This buffer

get

public Buffer get(char[] dst)

close

public void close()

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2002-2012 The Neo4j Graph Database Project. All Rights Reserved.