public class FileBuffer
extends java.lang.Object
implements java.lang.CharSequence
Constructor and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
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.
|
public FileBuffer(java.io.File textFile) throws java.io.IOException
textFile
- to be read into this bufferjava.io.IOException
- if the file can not be opendpublic FileBuffer(java.net.URL textFile) throws java.io.IOException
textFile
- resource for this bufferjava.io.IOException
- if the URL can not be opendpublic 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 filejava.io.IOException
- if the file can not be opendpublic 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 resourcejava.io.IOException
- if the URL can not be opendpublic int length()
length
in interface java.lang.CharSequence
public char charAt(int index)
charAt
in interface java.lang.CharSequence
public java.lang.CharSequence subSequence(int start, int end)
subSequence
in interface java.lang.CharSequence
public java.lang.String toString()
toString
in interface java.lang.CharSequence
toString
in class java.lang.Object
public void close()
protected void finalize()
finalize
in class java.lang.Object
public void setBufferSizeKb(int k)
k
- kilo bytepublic int getBufferSizeKb()