Seekable, Closeable, Flushable, AutoCloseablepublic abstract class SeekableOutputStream extends OutputStream implements Seekable
OutputStreams implementing the
Seekable interface.
SeekableInputStream| Modifier and Type | Field | Description |
|---|---|---|
protected Stack<Long> |
markedPositions |
| Constructor | Description |
|---|---|
SeekableOutputStream() |
| Modifier and Type | Method | Description |
|---|---|---|
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) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitwrite, writeisCached, isCachedFile, isCachedMemorypublic final void write(byte[] pBytes)
throws IOException
write in class OutputStreamIOExceptionpublic 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.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
IOExceptionpublic final void flush()
throws IOException
SeekableflushBefore(getStreamPosition()).flush in interface Flushableflush in interface Seekableflush 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
SeekablegetStreamPosition in interface Seekablelong containing the position of the stream.IOException - if an I/O error occurs.protected final void checkOpen()
throws IOException
IOExceptionpublic final void close()
throws IOException
Seekableclose in interface AutoCloseableclose in interface Closeableclose in interface Seekableclose in class OutputStreamIOException - if the stream can't be closed.protected abstract void closeImpl()
throws IOException
IOExceptionCopyright © 2018. All rights reserved.