|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.io.OutputStream
com.twelvemonkeys.io.SeekableOutputStream
public abstract class SeekableOutputStream
Abstract base class for OutputStreams implementing the
Seekable interface.
SeekableInputStream| Field Summary | |
|---|---|
protected Stack<Long> |
markedPositions
|
| Constructor Summary | |
|---|---|
SeekableOutputStream()
|
|
| Method Summary | |
|---|---|
protected void |
checkOpen()
|
void |
close()
Closes the stream. |
protected abstract void |
closeImpl()
|
void |
flush()
Discards the initial position of the stream prior to the current stream position. |
void |
flushBefore(long pPosition)
Discards the initial portion of the stream prior to the indicated postion. |
protected abstract void |
flushBeforeImpl(long pPosition)
|
long |
getFlushedPosition()
Returns the earliest position in the stream to which seeking may be performed. |
long |
getStreamPosition()
Returns the current byte position of the stream. |
void |
mark()
Marks a position in the stream to be returned to by a subsequent call to reset. |
void |
reset()
Returns the file pointer to its previous position, at the time of the most recent unmatched call to mark. |
void |
seek(long pPosition)
Sets the current stream position to the desired location. |
protected abstract void |
seekImpl(long pPosition)
|
void |
write(byte[] pBytes)
|
| Methods inherited from class java.io.OutputStream |
|---|
write, write |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.twelvemonkeys.io.Seekable |
|---|
isCached, isCachedFile, isCachedMemory |
| Field Detail |
|---|
protected Stack<Long> markedPositions
| Constructor Detail |
|---|
public SeekableOutputStream()
| Method Detail |
|---|
public final void write(byte[] pBytes)
throws IOException
write in class OutputStreamIOException
public final void seek(long pPosition)
throws IOException
SeekableIndexOutOfBoundsException will be thrown if pPosition is smaller
than the flushed position (as returned by Seekable.getFlushedPosition()).
It is legal to seek past the end of the file; an EOFException
will be thrown only if a read is performed.
seek in interface SeekablepPosition - a long containing the desired file pointer position.
IOException - if any other I/O error occurs.
protected abstract void seekImpl(long pPosition)
throws IOException
IOExceptionpublic final void mark()
SeekableInputStream, all Seekable
streams upport marking. Additionally, calls to mark and
reset may be nested arbitrarily.
Unlike the mark methods declared by the Reader or
InputStream
interfaces, no readLimit parameter is used. An arbitrary amount
of data may be read following the call to mark.
mark in interface Seekable
public final void reset()
throws IOException
SeekableIOExceptionIOException will be thrown if the previous marked position
lies in the discarded portion of the stream.
reset in interface SeekableIOException - if an I/O error occurs.InputStream.reset()
public final void flushBefore(long pPosition)
throws IOException
SeekableIndexOutOfBoundsException.
Calling flushBefore may allow classes implementing this
interface to free up resources such as memory or disk space that are
being used to store data from the stream.
flushBefore in interface SeekablepPosition - a long containing the length of the file prefix that
may be flushed.
IOException - if an I/O error occurs.
protected abstract void flushBeforeImpl(long pPosition)
throws IOException
IOException
public final void flush()
throws IOException
SeekableflushBefore(getStreamPosition()).
flush in interface Seekableflush in interface Flushableflush in class OutputStreamIOException - if an I/O error occurs.
public final long getFlushedPosition()
throws IOException
SeekableflushBefore.
getFlushedPosition in interface Seekablelong.
IOException - if an I/O error occurs.
public final long getStreamPosition()
throws IOException
Seekable
getStreamPosition in interface Seekablelong containing the position of the stream.
IOException - if an I/O error occurs.
protected final void checkOpen()
throws IOException
IOException
public final void close()
throws IOException
Seekable
close in interface Seekableclose in interface Closeableclose in class OutputStreamIOException - if the stream can't be closed.
protected abstract void closeImpl()
throws IOException
IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||