|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.pandoragames.util.file.FileBuffer
public class FileBuffer
Implementation of the CharSequence interface over a FileInputStream. This class
may be used when very large portions of text are to be handled, too large to be
kept in memory (i.e. as String or StringBuffer).
Despite its name, the object may as well be created with a URL as resource.
| Constructor Summary | |
|---|---|
FileBuffer(java.io.File textFile)
Creates the buffer with the specified file and the default character set. |
|
FileBuffer(java.io.File textFile,
java.nio.charset.Charset charset)
Creates the buffer with the specified file and character set. |
|
FileBuffer(java.net.URL textFile)
Creates the buffer from the specified URL and the default character set. |
|
FileBuffer(java.net.URL textFile,
java.nio.charset.Charset charset)
Creates the buffer from the specified URL using the indicated character set. |
|
| Method Summary | |
|---|---|
char |
charAt(int index)
|
void |
close()
Closes this buffer. |
protected void |
finalize()
Calls the close() method. |
int |
getBufferSizeKb()
Returns the internal buffer size in kilo byte. |
int |
length()
|
void |
setBufferSizeKb(int k)
Sets the internal buffer size in kilo byte. |
java.lang.CharSequence |
subSequence(int start,
int end)
|
java.lang.String |
toString()
Returns a string containing the characters in this sequence in the same order as this sequence. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public FileBuffer(java.io.File textFile)
throws java.io.IOException
textFile - to be read into this buffer
java.io.IOException - if the file can not be opend
public FileBuffer(java.net.URL textFile)
throws java.io.IOException
textFile - resource for this buffer
java.io.IOException - if the URL can not be opend
public FileBuffer(java.io.File textFile,
java.nio.charset.Charset charset)
throws java.io.IOException
textFile - to be read into this buffercharset - to be used to decode the file
java.io.IOException - if the file can not be opend
public FileBuffer(java.net.URL textFile,
java.nio.charset.Charset charset)
throws java.io.IOException
textFile - resource for this buffercharset - to be used to decode the resource
java.io.IOException - if the URL can not be opend| Method Detail |
|---|
public int length()
length in interface java.lang.CharSequencepublic char charAt(int index)
charAt in interface java.lang.CharSequence
public java.lang.CharSequence subSequence(int start,
int end)
subSequence in interface java.lang.CharSequencepublic java.lang.String toString()
toString in interface java.lang.CharSequencetoString in class java.lang.Objectpublic void close()
protected void finalize()
finalize in class java.lang.Objectpublic void setBufferSizeKb(int k)
k - kilo bytepublic int getBufferSizeKb()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||