Top Description Fields Constructors Methods
org.apache.commons.compress.archivers.zip

pack-priv Class FileRandomAccessOutputStream

extends RandomAccessOutputStream
Class Inheritance
Imports
java.io.IOException, java.nio.ByteBuffer, java.nio.channels.FileChannel, java.nio.file.OpenOption, .Path, .StandardOpenOption, java.util.Objects

RandomAccessOutputStream implementation based on a file.

Field Summary

Modifier and TypeField and Description
private final FileChannel
private long

Constructor Summary

AccessConstructor and Description
pack-priv
pack-priv
pack-priv
FileRandomAccessOutputStream(final Path file, final OpenOption... options)

Method Summary

Modifier and TypeMethod and Description
pack-priv FileChannel
public void
close()

Overrides java.io.OutputStream.close.

Implements java.io.Closeable.close.

Closes this output stream and releases any system resources associated with this stream.
public synchronized long
position()

Implements abstract org.apache.commons.compress.archivers.zip.RandomAccessOutputStream.position.

Provides current position in output.
public synchronized void
write(final byte[]
the data.
b
,
final int
the start offset in the data.
off
,
final int
the number of bytes to write.
len
)

Overrides java.io.OutputStream.write.

Writes len bytes from the specified byte array starting at offset off to this output stream.
public void
writeFully(final byte[]
data to write
b
,
final int
offset of the start of data in param b
off
,
final int
the length of data to write
len
,
final long
position in the stream
atPosition
)

Implements abstract org.apache.commons.compress.archivers.zip.RandomAccessOutputStream.writeFully.

Writes given data to specific position.
Inherited from org.apache.commons.compress.archivers.zip.RandomAccessOutputStream:
writewriteFully

Field Detail

channelback to summary
private final FileChannel channel
positionback to summary
private long position

Constructor Detail

FileRandomAccessOutputStreamback to summary
pack-priv FileRandomAccessOutputStream(final FileChannel channel)
FileRandomAccessOutputStreamback to summary
pack-priv FileRandomAccessOutputStream(final Path file) throws IOException
FileRandomAccessOutputStreamback to summary
pack-priv FileRandomAccessOutputStream(final Path file, final OpenOption... options) throws IOException

Method Detail

channelback to summary
pack-priv FileChannel channel()
closeback to summary
public void close() throws IOException

Overrides java.io.OutputStream.close.

Implements java.io.Closeable.close.

Doc from java.io.OutputStream.close.

Closes this output stream and releases any system resources associated with this stream. The general contract of close is that it closes the output stream. A closed stream cannot perform output operations and cannot be reopened.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs.
positionback to summary
public synchronized long position()

Implements abstract org.apache.commons.compress.archivers.zip.RandomAccessOutputStream.position.

Doc from org.apache.commons.compress.archivers.zip.RandomAccessOutputStream.position.

Provides current position in output.

Returns:long

current position.

Annotations
@Override
writeback to summary
public synchronized void write(final byte[] b, final int off, final int len) throws IOException

Overrides java.io.OutputStream.write.

Doc from java.io.OutputStream.write.

Writes len bytes from the specified byte array starting at offset off to this output stream. The general contract for write(b, off, len) is that some of the bytes in the array b are written to the output stream in order; element b[off] is the first byte written and b[off+len-1] is the last byte written by this operation.

If b is null, a NullPointerException is thrown.

If off is negative, or len is negative, or off+len is greater than the length of the array b, then an IndexOutOfBoundsException is thrown.

Parameters
b:byte[]

the data.

off:int

the start offset in the data.

len:int

the number of bytes to write.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs. In particular, an IOException is thrown if the output stream is closed.
writeFullyback to summary
public void writeFully(final byte[] b, final int off, final int len, final long atPosition) throws IOException

Implements abstract org.apache.commons.compress.archivers.zip.RandomAccessOutputStream.writeFully.

Doc from org.apache.commons.compress.archivers.zip.RandomAccessOutputStream.writeFully.

Writes given data to specific position.

Parameters
b:byte[]

data to write

off:int

offset of the start of data in param b

len:int

the length of data to write

atPosition:long

position in the stream

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs.