calypso.util
Class RandomAccessFileWithByteLines
java.lang.Object
|
+--calypso.util.RandomAccessFileWithByteLines
- public class RandomAccessFileWithByteLines
- extends java.lang.Object
Field Summary |
protected byte[] |
fBuffer
|
protected int |
fEnd
|
protected java.io.RandomAccessFile |
fInput
|
protected int |
fOffset
|
Method Summary |
boolean |
eatNewline()
Eat up one newline if present in the fBuffer. |
protected boolean |
fill()
|
protected boolean |
fillForCapacity(int capacity)
Fill the fBuffer, keeping whatever is unread in the fBuffer and
ensuring that "capacity" characters of total filled fBuffer
space is available. |
long |
getFilePointer()
|
void |
readFully(byte[] arr,
int off,
int length)
|
boolean |
readLine(ByteBuf buf)
|
void |
seek(long loc)
|
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
fInput
protected java.io.RandomAccessFile fInput
fBuffer
protected byte[] fBuffer
fOffset
protected int fOffset
fEnd
protected int fEnd
RandomAccessFileWithByteLines
public RandomAccessFileWithByteLines(java.io.RandomAccessFile f)
readLine
public boolean readLine(ByteBuf buf)
throws java.io.IOException
eatNewline
public boolean eatNewline()
throws java.io.IOException
- Eat up one newline if present in the fBuffer. If a newline
was eaten up return true otherwise false. This will handle
mac (\r), unix (\n) and windows (\r\n) style of newlines
transparently.
getFilePointer
public long getFilePointer()
throws java.io.IOException
seek
public void seek(long loc)
throws java.io.IOException
fill
protected boolean fill()
throws java.io.IOException
fillForCapacity
protected boolean fillForCapacity(int capacity)
throws java.io.IOException
- Fill the fBuffer, keeping whatever is unread in the fBuffer and
ensuring that "capacity" characters of total filled fBuffer
space is available. Return false if the final amount of data
in the fBuffer is less than capacity, otherwise return true.
readFully
public void readFully(byte[] arr,
int off,
int length)
throws java.io.IOException