Class SeekableOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- org.apache.xmlgraphics.image.codec.util.SeekableOutputStream
-
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
public class SeekableOutputStream extends OutputStream
AnOutputStreamwhich can seek to an arbitrary offset.- Version:
- $Id: SeekableOutputStream.java 1732018 2016-02-24 04:51:06Z gadams $
-
-
Constructor Summary
Constructors Constructor Description SeekableOutputStream(RandomAccessFile file)Constructs aSeekableOutputStreamfrom aRandomAccessFile.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()voidflush()InvokesgetFD().sync()on the underlyingRandomAccessFile.longgetFilePointer()voidseek(long pos)voidwrite(byte[] b)voidwrite(byte[] b, int off, int len)voidwrite(int b)-
Methods inherited from class java.io.OutputStream
nullOutputStream
-
-
-
-
Constructor Detail
-
SeekableOutputStream
public SeekableOutputStream(RandomAccessFile file)
Constructs aSeekableOutputStreamfrom aRandomAccessFile. Unless otherwise indicated, all method invocations are fowarded to the underlyingRandomAccessFile.- Parameters:
file- TheRandomAccessFileto which calls will be forwarded.- Throws:
IllegalArgumentException- iffileisnull.
-
-
Method Detail
-
write
public void write(int b) throws IOException- Specified by:
writein classOutputStream- Throws:
IOException
-
write
public void write(byte[] b) throws IOException- Overrides:
writein classOutputStream- Throws:
IOException
-
write
public void write(byte[] b, int off, int len) throws IOException- Overrides:
writein classOutputStream- Throws:
IOException
-
flush
public void flush() throws IOExceptionInvokesgetFD().sync()on the underlyingRandomAccessFile.- Specified by:
flushin interfaceFlushable- Overrides:
flushin classOutputStream- Throws:
IOException
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classOutputStream- Throws:
IOException
-
getFilePointer
public long getFilePointer() throws IOException- Throws:
IOException
-
seek
public void seek(long pos) throws IOException- Throws:
IOException
-
-