public class EXRFileOutputStream extends Object implements EXROutputStream, AutoCloseable
EXROutputStream
from a
file. This class acquires an exclusive write lock on the file and implements
AutoCloseable
so that it may be used in try
-with-resources.Constructor and Description |
---|
EXRFileOutputStream(Path path) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
long |
position()
Get the current writing position, in bytes from the beginning of the
stream.
|
EXROutputStream |
position(long pos)
Set the current position.
|
void |
write(ByteBuffer src)
Write to the stream.
|
public EXRFileOutputStream(Path path) throws EXRIOException
EXRIOException
public void close() throws EXRIOException
close
in interface AutoCloseable
EXRIOException
public void write(ByteBuffer src) throws EXRIOException
EXROutputStream
write(dst)
writes n bytes to the stream, where
n is the number of bytes remaining in the buffer, that is,
dst.remaining()
, at the moment this method is invoked. The bytes
are written from the current position of the buffer.
If an I/O error occurs, write(dst)
throws an exception.
write
in interface EXROutputStream
src
- The buffer from which bytes are to be transferredEXRIOException
- if an I/O error occurs.public long position() throws EXRIOException
EXROutputStream
write()
will write the first byte in
the stream, position()
returns 0.position
in interface EXROutputStream
EXRIOException
- if an I/O error occurs.public EXROutputStream position(long pos) throws EXRIOException
EXROutputStream
position(i)
,
position()
returns i.position
in interface EXROutputStream
pos
- the new writing position.EXRIOException
- if an I/O error occurs.