|
|||||||||
| Home >> All >> org >> apache >> derby >> impl >> store >> raw >> [ data overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.apache.derby.impl.store.raw.data
Class MemByteHolder

java.lang.Objectorg.apache.derby.impl.store.raw.data.MemByteHolder
- All Implemented Interfaces:
- ByteHolder
- public class MemByteHolder
- extends java.lang.Object
- implements ByteHolder
- extends java.lang.Object
A ByteHolder that stores all its bytes in memory.
| Field Summary | |
(package private) int |
bufSize
|
(package private) java.util.Vector |
bufV
|
(package private) byte[] |
curBuf
|
(package private) int |
curBufDataBytes
|
(package private) int |
curBufPos
|
(package private) int |
curBufVEleAt
|
(package private) int |
lastBufDataBytes
|
(package private) int |
lastBufVEleAt
|
(package private) boolean |
writing
|
| Constructor Summary | |
MemByteHolder(int bufSize)
Create a new MemByteHolder. |
|
| Method Summary | |
int |
available()
Return the number of bytes that can be read from this ByteHolder without blocking on an IO. |
void |
clear()
Clear the bytes from the ByteHolder and place it in writing mode. |
private java.lang.String |
dumpBuf(int bufVEleAt)
Create a string representation of an internal buffer of bytes. |
protected boolean |
getNextBuffer_r()
Get the next buffer for reading bytes. |
protected void |
getNextBuffer_w_Sanity()
Do sanity checking when getting the next write buffer |
protected void |
getNextBuffer_w()
Get the next buffer for writing bytes. |
protected void |
initBuffer_w()
Initialize a buffer for writing |
int |
numBytesSaved()
Return the number of bytes that have been saved to this byte holder. |
int |
read()
Read a byte from this ByteHolder. |
int |
read(byte[] b,
int off,
int len)
Read up to 'len' bytes from this ByteHolder and store them in an array at offset 'off'. |
int |
read(byte[] b,
int off,
java.io.OutputStream out,
int len)
|
int |
read(java.io.OutputStream out,
int len)
Read from the ByteHolder. |
int |
shiftToFront()
shift the remaining unread bytes to the beginning of the byte holder |
long |
skip(long count)
Skip over the specified number of bytes in a ByteHolder. |
void |
startReading()
Place a ByteHolder in reading mode. |
java.lang.String |
toString()
Produce a string describing the state of this ByteHolder. |
void |
write(byte[] data,
int offset,
int len)
Write len bytes of data starting at 'offset' to this ByteHolder. |
long |
write(java.io.InputStream is,
long count)
Write up to count bytes from an input stream to this ByteHolder. |
void |
write(int b)
Write a byte to this ByteHolder. |
boolean |
writingMode()
Return true if this is in writing mode. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
bufSize
int bufSize
writing
boolean writing
bufV
java.util.Vector bufV
curBufVEleAt
int curBufVEleAt
curBuf
byte[] curBuf
curBufPos
int curBufPos
curBufDataBytes
int curBufDataBytes
lastBufVEleAt
int lastBufVEleAt
lastBufDataBytes
int lastBufDataBytes
| Constructor Detail |
MemByteHolder
public MemByteHolder(int bufSize)
- Create a new MemByteHolder. Store bytes as a list of buffers
of size 'bufSize'.
| Method Detail |
write
public void write(int b)
throws java.io.IOException
- Description copied from interface:
ByteHolder - Write a byte to this ByteHolder.
The ByteHolder must be in writing mode to call this.
- Specified by:
writein interfaceByteHolder
write
public void write(byte[] data,
int offset,
int len)
throws java.io.IOException
- Description copied from interface:
ByteHolder - Write len bytes of data starting at 'offset' to this ByteHolder.
The ByteHolder must be in writing mode to call this.
- Specified by:
writein interfaceByteHolder
write
public long write(java.io.InputStream is, long count) throws java.io.IOException
- Description copied from interface:
ByteHolder - Write up to count bytes from an input stream to this
ByteHolder. This may write fewer bytes if it encounters
an end of file on the input stream.
- Specified by:
writein interfaceByteHolder
clear
public void clear()
throws java.io.IOException
- Description copied from interface:
ByteHolder - Clear the bytes from the ByteHolder and place it in writing
mode. This may not free the memory the ByteHolder uses to
store data.
- Specified by:
clearin interfaceByteHolder
startReading
public void startReading()
throws java.io.IOException
- Description copied from interface:
ByteHolder - Place a ByteHolder in reading mode. After this call,
reads scan bytes sequentially in the order they were
written to the ByteHolder starting from the first byte.
When the ByteHolder is already in readmode this simply
arranges for reads to start at the beginning of the
sequence of saved bytes.
- Specified by:
startReadingin interfaceByteHolder
read
public int read()
throws java.io.IOException
- Description copied from interface:
ByteHolder - Read a byte from this ByteHolder.
The ByteHolder must be in reading mode to call this.
- Specified by:
readin interfaceByteHolder
read
public int read(byte[] b,
int off,
int len)
throws java.io.IOException
- Description copied from interface:
ByteHolder - Read up to 'len' bytes from this ByteHolder and store them in
an array at offset 'off'.
The ByteHolder must be in reading mode to call this.
- Specified by:
readin interfaceByteHolder
read
public int read(java.io.OutputStream out, int len) throws java.io.IOException
- Description copied from interface:
ByteHolder - Read from the ByteHolder.
Read up to 'len' bytes from this ByteHolder and write them to the OutputStream
The ByteHolder must be in reading mode to call this.
- Specified by:
readin interfaceByteHolder
read
public int read(byte[] b,
int off,
java.io.OutputStream out,
int len)
throws java.io.IOException
shiftToFront
public int shiftToFront()
throws java.io.IOException
- Description copied from interface:
ByteHolder - shift the remaining unread bytes to the beginning of the byte holder
- Specified by:
shiftToFrontin interfaceByteHolder
available
public int available()
- Description copied from interface:
ByteHolder - Return the number of bytes that can be read from this ByteHolder
without blocking on an IO.
- Specified by:
availablein interfaceByteHolder
numBytesSaved
public int numBytesSaved()
- Return the number of bytes that have been saved to this byte holder.
This result is different from available() as it is unaffected by the
current read position on the ByteHolder.
- Specified by:
numBytesSavedin interfaceByteHolder
skip
public long skip(long count)
throws java.io.IOException
- Description copied from interface:
ByteHolder - Skip over the specified number of bytes in a ByteHolder.
- Specified by:
skipin interfaceByteHolder
writingMode
public boolean writingMode()
- Description copied from interface:
ByteHolder - Return true if this is in writing mode.
- Specified by:
writingModein interfaceByteHolder
getNextBuffer_w
protected void getNextBuffer_w()
throws java.io.IOException
- Get the next buffer for writing bytes.
getNextBuffer_w_Sanity
protected void getNextBuffer_w_Sanity()
- Do sanity checking when getting the next write buffer
initBuffer_w
protected void initBuffer_w()
- Initialize a buffer for writing
getNextBuffer_r
protected boolean getNextBuffer_r()
throws java.io.IOException
- Get the next buffer for reading bytes.
dumpBuf
private java.lang.String dumpBuf(int bufVEleAt)
- Create a string representation of an internal buffer of bytes.
This is useful during debugging.
toString
public java.lang.String toString()
- Produce a string describing the state of this ByteHolder.
This is mainly for debugging.
|
|||||||||
| Home >> All >> org >> apache >> derby >> impl >> store >> raw >> [ data overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
org.apache.derby.impl.store.raw.data.MemByteHolder