jaulib v1.2.0
Jau Support Library (C++, Java, ..)
Public Member Functions | List of all members
org.jau.io.MappedByteBufferOutputStream Class Reference

An OutputStream implementation based on an underlying FileChannel's memory mapped ByteBuffer. More...

Inheritance diagram for org.jau.io.MappedByteBufferOutputStream:
Collaboration diagram for org.jau.io.MappedByteBufferOutputStream:

Public Member Functions

 MappedByteBufferOutputStream (final FileChannel fileChannel, final FileChannel.MapMode mmode, final CacheMode cmode, final int sliceShift, final FileResizeOp fileResizeOp) throws IOException
 Creates a new instance using the given FileChannel. More...
 
final synchronized void setSynchronous (final boolean s)
 See MappedByteBufferInputStream#setSynchronous(boolean). More...
 
final synchronized boolean getSynchronous ()
 See MappedByteBufferInputStream#getSynchronous(). More...
 
final synchronized void setLength (final long newTotalSize) throws IOException
 See MappedByteBufferInputStream#setLength(long). More...
 
final synchronized void notifyLengthChange (final long newTotalSize) throws IOException
 See MappedByteBufferInputStream#notifyLengthChange(long). More...
 
final synchronized long length ()
 See MappedByteBufferInputStream#length(). More...
 
final synchronized long remaining () throws IOException
 See MappedByteBufferInputStream#remaining(). More...
 
final synchronized long position () throws IOException
 See MappedByteBufferInputStream#position(). More...
 
final synchronized MappedByteBufferInputStream position (final long newPosition) throws IOException
 See MappedByteBufferInputStream#position(long). More...
 
final synchronized long skip (final long n) throws IOException
 See MappedByteBufferInputStream#skip(long). More...
 
final synchronized void flush () throws IOException
 
final synchronized void flush (final boolean metaData) throws IOException
 See MappedByteBufferInputStream#flush(boolean). More...
 
final synchronized void close () throws IOException
 
final synchronized void write (final int b) throws IOException
 
final synchronized void write (final byte b[], final int off, final int len) throws IOException
 
final synchronized void write (final ByteBuffer b, final int len) throws IOException
 Perform similar to write(byte[], int, int) with ByteBuffer instead of byte array. More...
 
final synchronized void write (final MappedByteBufferInputStream b, final long len) throws IOException
 Perform similar to write(ByteBuffer, int) with MappedByteBufferInputStream instead of byte array. More...
 

Detailed Description

An OutputStream implementation based on an underlying FileChannel's memory mapped ByteBuffer.

Implementation is based on MappedByteBufferInputStream, using it as its parent instance.

An instance maybe created via its parent MappedByteBufferInputStream#getOutputStream(FileResizeOp) or directly MappedByteBufferOutputStream(FileChannel, MapMode, CacheMode, int, FileResizeOp).

Since
0.3.0

Definition at line 48 of file MappedByteBufferOutputStream.java.

Constructor & Destructor Documentation

◆ MappedByteBufferOutputStream()

org.jau.io.MappedByteBufferOutputStream.MappedByteBufferOutputStream ( final FileChannel  fileChannel,
final FileChannel.MapMode  mmode,
final CacheMode  cmode,
final int  sliceShift,
final FileResizeOp  fileResizeOp 
) throws IOException

Creates a new instance using the given FileChannel.

The ByteBuffer slices will be mapped lazily at first usage.

Parameters
fileChannelthe file channel to be mapped lazily.
mmodethe map mode, default is FileChannel.MapMode#READ_WRITE.
cmodethe caching mode, default is MappedByteBufferInputStream.CacheMode#FLUSH_PRE_SOFT.
sliceShiftthe pow2 slice size, default is MappedByteBufferInputStream#DEFAULT_SLICE_SHIFT.
fileResizeOpMappedByteBufferInputStream.FileResizeOp as described on MappedByteBufferInputStream#setFileResizeOp(FileResizeOp).
Exceptions
IOException

Definition at line 72 of file MappedByteBufferOutputStream.java.

Member Function Documentation

◆ close()

final synchronized void org.jau.io.MappedByteBufferOutputStream.close ( ) throws IOException

Definition at line 155 of file MappedByteBufferOutputStream.java.

Here is the call graph for this function:

◆ flush() [1/2]

final synchronized void org.jau.io.MappedByteBufferOutputStream.flush ( ) throws IOException

Definition at line 142 of file MappedByteBufferOutputStream.java.

Here is the call graph for this function:

◆ flush() [2/2]

final synchronized void org.jau.io.MappedByteBufferOutputStream.flush ( final boolean  metaData) throws IOException

See MappedByteBufferInputStream#flush(boolean).

Definition at line 150 of file MappedByteBufferOutputStream.java.

Here is the call graph for this function:

◆ getSynchronous()

final synchronized boolean org.jau.io.MappedByteBufferOutputStream.getSynchronous ( )

See MappedByteBufferInputStream#getSynchronous().

Definition at line 88 of file MappedByteBufferOutputStream.java.

Here is the call graph for this function:

◆ length()

final synchronized long org.jau.io.MappedByteBufferOutputStream.length ( )

See MappedByteBufferInputStream#length().

Definition at line 109 of file MappedByteBufferOutputStream.java.

Here is the call graph for this function:

◆ notifyLengthChange()

final synchronized void org.jau.io.MappedByteBufferOutputStream.notifyLengthChange ( final long  newTotalSize) throws IOException

See MappedByteBufferInputStream#notifyLengthChange(long).

Definition at line 102 of file MappedByteBufferOutputStream.java.

Here is the call graph for this function:

◆ position() [1/2]

final synchronized long org.jau.io.MappedByteBufferOutputStream.position ( ) throws IOException

See MappedByteBufferInputStream#position().

Definition at line 123 of file MappedByteBufferOutputStream.java.

Here is the call graph for this function:

◆ position() [2/2]

final synchronized MappedByteBufferInputStream org.jau.io.MappedByteBufferOutputStream.position ( final long  newPosition) throws IOException

See MappedByteBufferInputStream#position(long).

Definition at line 130 of file MappedByteBufferOutputStream.java.

Here is the call graph for this function:

◆ remaining()

final synchronized long org.jau.io.MappedByteBufferOutputStream.remaining ( ) throws IOException

See MappedByteBufferInputStream#remaining().

Definition at line 116 of file MappedByteBufferOutputStream.java.

Here is the call graph for this function:

◆ setLength()

final synchronized void org.jau.io.MappedByteBufferOutputStream.setLength ( final long  newTotalSize) throws IOException

See MappedByteBufferInputStream#setLength(long).

Definition at line 95 of file MappedByteBufferOutputStream.java.

Here is the call graph for this function:

◆ setSynchronous()

final synchronized void org.jau.io.MappedByteBufferOutputStream.setSynchronous ( final boolean  s)

See MappedByteBufferInputStream#setSynchronous(boolean).

Definition at line 82 of file MappedByteBufferOutputStream.java.

Here is the call graph for this function:

◆ skip()

final synchronized long org.jau.io.MappedByteBufferOutputStream.skip ( final long  n) throws IOException

See MappedByteBufferInputStream#skip(long).

Definition at line 137 of file MappedByteBufferOutputStream.java.

Here is the call graph for this function:

◆ write() [1/4]

final synchronized void org.jau.io.MappedByteBufferOutputStream.write ( final byte  b[],
final int  off,
final int  len 
) throws IOException

Definition at line 186 of file MappedByteBufferOutputStream.java.

Here is the call graph for this function:

◆ write() [2/4]

final synchronized void org.jau.io.MappedByteBufferOutputStream.write ( final ByteBuffer  b,
final int  len 
) throws IOException

Perform similar to write(byte[], int, int) with ByteBuffer instead of byte array.

Parameters
bthe ByteBuffer source, data is read from current ByteBuffer#position()
lenthe number of bytes to write
Exceptions
IOExceptionif a buffer slice operation failed or stream has been closed.

Definition at line 239 of file MappedByteBufferOutputStream.java.

Here is the call graph for this function:

◆ write() [3/4]

final synchronized void org.jau.io.MappedByteBufferOutputStream.write ( final int  b) throws IOException

Definition at line 160 of file MappedByteBufferOutputStream.java.

Here is the call graph for this function:

◆ write() [4/4]

final synchronized void org.jau.io.MappedByteBufferOutputStream.write ( final MappedByteBufferInputStream  b,
final long  len 
) throws IOException

Perform similar to write(ByteBuffer, int) with MappedByteBufferInputStream instead of byte array.

Method directly copies memory mapped ByteBuffer'ed data from the given input stream to this stream without extra data copy.

Parameters
bthe ByteBuffer source, data is read from current MappedByteBufferInputStream#position()
lenthe number of bytes to write
Exceptions
IOExceptionif a buffer slice operation failed or stream has been closed.

Definition at line 308 of file MappedByteBufferOutputStream.java.

Here is the call graph for this function:

The documentation for this class was generated from the following file: