|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.ibm.commons.util.io.CharacterStreamCache
public class CharacterStreamCache
Characters buffer.
This class is used to store characters and provides both an Writer for storing the bytes and an Reader for reading them. It stores the characters in memory in a highly optimized way, with a possibility of using a backing file when the content is bigger than a predefined threshold.
Nested Class Summary | |
---|---|
protected class |
CharacterStreamCache.InternalReader
|
protected class |
CharacterStreamCache.InternalWriter
|
Field Summary | |
---|---|
static int |
DEFAULT_BLOCKSIZE
|
static int |
DEFAULT_THRESHOLD
|
Constructor Summary | |
---|---|
CharacterStreamCache()
|
|
CharacterStreamCache(int blockSize,
int threshold)
|
Method Summary | |
---|---|
void |
clear()
Clear the data inside the cache. |
void |
copyFrom(java.io.Reader r)
Init the data from an existing reader. |
void |
copyTo(java.io.File f)
Copy the stream to a file. |
void |
copyTo(java.io.Writer w)
Copy the stream to another stream. |
char |
getChar(int pos)
Get an indexed character. |
long |
getLength()
Get the number of stored bytes. |
java.io.Reader |
getReader()
Get a reader on the stored data. |
java.io.Writer |
getWriter()
Get a writer to store the data. |
boolean |
isEqual(CharacterStreamCache other)
|
char[] |
toCharArray()
Convert to a char array. |
java.lang.String |
toString()
|
void |
write(char[] b)
|
void |
write(char[] b,
int off,
int len)
|
void |
write(int b)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_BLOCKSIZE
public static final int DEFAULT_THRESHOLD
Constructor Detail |
---|
public CharacterStreamCache()
public CharacterStreamCache(int blockSize, int threshold)
Method Detail |
---|
public boolean isEqual(CharacterStreamCache other)
public long getLength()
public char getChar(int pos)
public void clear()
public java.io.Reader getReader()
public java.io.Writer getWriter()
public void copyFrom(java.io.Reader r) throws java.io.IOException
java.io.IOException
public void copyTo(java.io.Writer w) throws java.io.IOException
java.io.IOException
public void copyTo(java.io.File f) throws java.io.IOException
java.io.IOException
public char[] toCharArray()
public java.lang.String toString()
toString
in class java.lang.Object
public final void write(int b) throws java.io.IOException
java.io.IOException
public final void write(char[] b) throws java.io.IOException
java.io.IOException
public final void write(char[] b, int off, int len) throws java.io.IOException
java.io.IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |