public class RandomAccessCharacterFile extends Object
Modifier and Type | Class and Description |
---|---|
private class |
RandomAccessCharacterFile.RandomAccessInputStream |
private class |
RandomAccessCharacterFile.RandomAccessOutputStream |
private class |
RandomAccessCharacterFile.RandomAccessReader |
private class |
RandomAccessCharacterFile.RandomAccessWriter |
Modifier and Type | Field and Description |
---|---|
private ByteBuffer |
bbuf
bbuf is treated as a cache of the file content.
|
private boolean |
bbufIsDirty |
private boolean |
bbufIsReadable |
private long |
bbufpos |
(package private) static int |
BUFSIZ |
private CharsetDecoder |
cdec |
private CharsetEncoder |
cenc |
private Charset |
cset |
private FileChannel |
fcn |
private RandomAccessCharacterFile.RandomAccessInputStream |
inputStream |
private RandomAccessCharacterFile.RandomAccessOutputStream |
outputStream |
private RandomAccessCharacterFile.RandomAccessReader |
reader |
private ByteBuffer |
shortByteBuf |
private CharBuffer |
singleCharBuf |
(package private) static Reader |
staticReader |
private RandomAccessCharacterFile.RandomAccessWriter |
writer |
Constructor and Description |
---|
RandomAccessCharacterFile(RandomAccessFile raf,
String encoding) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
private void |
encodeAndWrite(CharBuffer cbuf,
boolean flush,
boolean endOfFile) |
private boolean |
ensureReadBbuf(boolean force) |
void |
flush() |
private void |
flushBbuf(boolean commitOnly) |
PushbackInputStream |
getInputStream() |
OutputStream |
getOutputStream() |
PushbackReader |
getReader() |
Writer |
getWriter() |
private void |
internalFlush(boolean endOfFile) |
long |
length() |
long |
position() |
void |
position(long newPosition) |
int |
read(byte[] b,
int off,
int len) |
(package private) int |
read(char[] cb,
int off,
int len) |
void |
setEncoding(String encoding) |
void |
unreadByte(byte b) |
void |
unreadChar(char c) |
(package private) void |
write(byte[] b,
int off,
int len) |
(package private) void |
write(char[] cb,
int off,
int len) |
static Reader staticReader
static final int BUFSIZ
private RandomAccessCharacterFile.RandomAccessWriter writer
private RandomAccessCharacterFile.RandomAccessReader reader
private RandomAccessCharacterFile.RandomAccessInputStream inputStream
private RandomAccessCharacterFile.RandomAccessOutputStream outputStream
private FileChannel fcn
private Charset cset
private CharsetEncoder cenc
private CharsetDecoder cdec
private ByteBuffer bbuf
private boolean bbufIsDirty
private boolean bbufIsReadable
private long bbufpos
private CharBuffer singleCharBuf
private ByteBuffer shortByteBuf
public RandomAccessCharacterFile(RandomAccessFile raf, String encoding) throws IOException
IOException
public void setEncoding(String encoding)
public Writer getWriter()
public PushbackReader getReader()
public PushbackInputStream getInputStream()
public OutputStream getOutputStream()
public final void close() throws IOException
IOException
public final void flush() throws IOException
IOException
private final boolean ensureReadBbuf(boolean force) throws IOException
IOException
final int read(char[] cb, int off, int len) throws IOException
IOException
final void write(char[] cb, int off, int len) throws IOException
IOException
private final void internalFlush(boolean endOfFile) throws IOException
IOException
private final void encodeAndWrite(CharBuffer cbuf, boolean flush, boolean endOfFile) throws IOException
IOException
public final void position(long newPosition) throws IOException
IOException
public final long position() throws IOException
IOException
public final long length() throws IOException
IOException
private final void flushBbuf(boolean commitOnly) throws IOException
IOException
public final int read(byte[] b, int off, int len) throws IOException
IOException
public final void unreadChar(char c) throws IOException
IOException
public final void unreadByte(byte b) throws IOException
IOException
final void write(byte[] b, int off, int len) throws IOException
IOException