org.neodatis.tool.wrappers.io
Class MultiBufferVO

java.lang.Object
  extended by org.neodatis.tool.wrappers.io.MultiBufferVO

public class MultiBufferVO
extends java.lang.Object

A simple class to store bytes

Author:
olivier

Field Summary
 long[] bufferEndPosition
          The current end position of the buffer
 byte[][] buffers
           
 long[] bufferStartPosition
          The current start position of the buffer
protected  long[] creations
           
 int[] maxPositionInBuffer
          The max position in the buffer, used to optimize the flush - to flush only new data and not all the buffer
 
Constructor Summary
MultiBufferVO(int numberOfBuffers, int bufferSize)
           
 
Method Summary
 void clear()
           
 void clearBuffer(int bufferIndex)
           
 byte[] getBuffer2(int index)
           
 int getBufferIndexForPosition(long position, int size)
           
 byte getByte(int bufferIndex, int byteIndex)
           
 long getCreationDate(int bufferIndex)
           
 boolean hasBeenUsedForWrite(int bufferIndex)
           
 void setByte(int bufferIndex, int positionInBuffer, byte b)
           
 void setCreationDate(int bufferIndex, long currentTimeInMs)
           
 void setPositions(int bufferIndex, long startPosition, long endPosition, int maxPosition)
           
 void writeBytes(int bufferIndex, byte[] bytes, int startIndex, int offsetWhereToCopy, int lengthToCopy)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

buffers

public byte[][] buffers

creations

protected long[] creations

bufferStartPosition

public long[] bufferStartPosition
The current start position of the buffer


bufferEndPosition

public long[] bufferEndPosition
The current end position of the buffer


maxPositionInBuffer

public int[] maxPositionInBuffer
The max position in the buffer, used to optimize the flush - to flush only new data and not all the buffer

Constructor Detail

MultiBufferVO

public MultiBufferVO(int numberOfBuffers,
                     int bufferSize)
Method Detail

getBuffer2

public byte[] getBuffer2(int index)

getByte

public byte getByte(int bufferIndex,
                    int byteIndex)

clearBuffer

public void clearBuffer(int bufferIndex)
Parameters:
i -

setByte

public void setByte(int bufferIndex,
                    int positionInBuffer,
                    byte b)
Parameters:
bufferIndex -
positionInBuffer -
b -

getBufferIndexForPosition

public int getBufferIndexForPosition(long position,
                                     int size)

setCreationDate

public void setCreationDate(int bufferIndex,
                            long currentTimeInMs)
Parameters:
bufferIndex -
currentTimeInMs -

setPositions

public void setPositions(int bufferIndex,
                         long startPosition,
                         long endPosition,
                         int maxPosition)
Parameters:
bufferIndex -
newPosition -
endPosition -
i -

writeBytes

public void writeBytes(int bufferIndex,
                       byte[] bytes,
                       int startIndex,
                       int offsetWhereToCopy,
                       int lengthToCopy)
Parameters:
bufferIndex -
bytes -
startIndex -
i -
lengthToCopy -

hasBeenUsedForWrite

public boolean hasBeenUsedForWrite(int bufferIndex)
Parameters:
bufferIndex -
Returns:

clear

public void clear()

getCreationDate

public long getCreationDate(int bufferIndex)
Parameters:
i -
Returns: