Package org.apache.ignite.internal.processors.cache.persistence.snapshot.dump

## Class BufferedFileIO

- java.lang.Object
- - org.apache.ignite.internal.processors.cache.persistence.file.AbstractFileIO
  - - org.apache.ignite.internal.processors.cache.persistence.file.FileIODecorator
    - - org.apache.ignite.internal.processors.cache.persistence.snapshot.dump.BufferedFileIO

All Implemented Interfaces:
  `AutoCloseable`, `FileIO`

Direct Known Subclasses:
  `WriteOnlyZipFileIO`

    public class BufferedFileIO
    extends FileIODecorator

The class implements a `FileIO` that allows to write bytes to the underlying `FileIO` without necessarily causing a call to the underlying system for each byte written. This IO writes to underlying storage whole buffer thus reduces number of system calls. It doesn't support reading or random access. It is not designed for writing concurrently from several threads.

### Field Summary

### Fields inherited from class org.apache.ignite.internal.processors.cache.persistence.file.FileIODecorator

`delegate`

### Constructor Summary

Constructors
`BufferedFileIO​(FileIO fileIO)`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `close()` Closes current file.
`protected void` `writeByte​(byte b)` Writes one byte.
`protected void` `writeBytes​(byte[] srcBuf, int off, int len)` Writes byte array.
`int` `writeFully​(ByteBuffer srcBuf)` Writes a sequence of bytes to this file from the `sourceBuffer`.

### Methods inherited from class org.apache.ignite.internal.processors.cache.persistence.file.FileIODecorator

`clear, force, force, getFileSystemBlockSize, getSparseSize, map, position, position, punchHole, read, read, read, size, transferFrom, transferTo, write, write, write`

### Methods inherited from class org.apache.ignite.internal.processors.cache.persistence.file.AbstractFileIO

`readFully, readFully, readFully, writeFully, writeFully`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### BufferedFileIO

    public BufferedFileIO​(FileIO fileIO)

### Method Detail

#### writeFully

    public int writeFully​(ByteBuffer srcBuf)
                   throws IOException

Writes a sequence of bytes to this file from the `sourceBuffer`.

Specified by:
  `writeFully` in interface `FileIO`
Overrides:
  `writeFully` in class `AbstractFileIO`
Parameters:
  `srcBuf` - Source buffer.
Returns:
  Number of written bytes.
Throws:
  `IOException` - If some I/O error occurs.

#### writeBytes

    protected void writeBytes​(byte[] srcBuf,
                              int off,
                              int len)
                       throws IOException

Writes byte array.

Throws:
  `IOException` - If some I/O error occurs.

#### writeByte

    protected void writeByte​(byte b)
                      throws IOException

Writes one byte.

Throws:
  `IOException` - If some I/O error occurs.

#### close

    public void close()
               throws IOException

Closes current file.

Specified by:
  `close` in interface `AutoCloseable`
Specified by:
  `close` in interface `FileIO`
Overrides:
  `close` in class `FileIODecorator`
Throws:
  `IOException` - If some I/O error occurs.