public class MemByteHolder extends java.lang.Object implements ByteHolder
Modifier and Type | Field and Description |
---|---|
(package private) int |
bufSize |
(package private) java.util.Vector<byte[]> |
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 and Description |
---|
MemByteHolder(int bufSize)
Create a new MemByteHolder.
|
Modifier and Type | Method and Description |
---|---|
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.
|
ByteHolder |
cloneEmpty()
Return a byte holder matching existing type and size of current
ByteHolder, but don't bother to fill the bytes.
|
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.
|
int bufSize
boolean writing
java.util.Vector<byte[]> bufV
int curBufVEleAt
byte[] curBuf
int curBufPos
int curBufDataBytes
int lastBufVEleAt
int lastBufDataBytes
public MemByteHolder(int bufSize)
public void write(int b) throws java.io.IOException
ByteHolder
The ByteHolder must be in writing mode to call this.
write
in interface ByteHolder
java.io.IOException
- Thrown on errorByteHolder.write(int)
public void write(byte[] data, int offset, int len) throws java.io.IOException
ByteHolder
The ByteHolder must be in writing mode to call this.
write
in interface ByteHolder
java.io.IOException
- Thrown on errorByteHolder.write(int)
public long write(java.io.InputStream is, long count) throws java.io.IOException
ByteHolder
write
in interface ByteHolder
java.io.IOException
- Thrown on errorByteHolder.write(int)
public void clear() throws java.io.IOException
ByteHolder
clear
in interface ByteHolder
java.io.IOException
- Thrown on errorByteHolder.clear()
public void startReading() throws java.io.IOException
ByteHolder
startReading
in interface ByteHolder
java.io.IOException
ByteHolder.startReading()
public int read() throws java.io.IOException
ByteHolder
The ByteHolder must be in reading mode to call this.
read
in interface ByteHolder
java.io.IOException
- Thrown on errorByteHolder.read()
public int read(byte[] b, int off, int len) throws java.io.IOException
ByteHolder
The ByteHolder must be in reading mode to call this.
read
in interface ByteHolder
java.io.IOException
- Thrown on errorByteHolder.read()
public int read(java.io.OutputStream out, int len) throws java.io.IOException
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.
read
in interface ByteHolder
java.io.IOException
- Thrown on errorByteHolder.read()
public int read(byte[] b, int off, java.io.OutputStream out, int len) throws java.io.IOException
java.io.IOException
- Thrown on errorByteHolder.read()
public int shiftToFront() throws java.io.IOException
ByteHolder
shiftToFront
in interface ByteHolder
java.io.IOException
- Thrown on errorByteHolder.shiftToFront()
public int available()
ByteHolder
available
in interface ByteHolder
ByteHolder.available()
public int numBytesSaved()
numBytesSaved
in interface ByteHolder
ByteHolder.numBytesSaved()
public long skip(long count) throws java.io.IOException
ByteHolder
skip
in interface ByteHolder
java.io.IOException
- Thrown on errorByteHolder.skip(long)
public boolean writingMode()
ByteHolder
writingMode
in interface ByteHolder
ByteHolder.writingMode()
public ByteHolder cloneEmpty()
ByteHolder
cloneEmpty
in interface ByteHolder
ByteHolder
.ByteHolder.cloneEmpty()
protected void getNextBuffer_w() throws java.io.IOException
java.io.IOException
- Thrown on errorprotected void getNextBuffer_w_Sanity()
protected void initBuffer_w()
protected boolean getNextBuffer_r() throws java.io.IOException
java.io.IOException
- Thrown on errorprivate java.lang.String dumpBuf(int bufVEleAt)
public java.lang.String toString()
toString
in class java.lang.Object
Apache Derby V10.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.