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 aFileIOthat allows to write bytes to the underlyingFileIOwithout 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 Constructor Description BufferedFileIO(FileIO fileIO)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes current file.protected voidwriteByte(byte b)Writes one byte.protected voidwriteBytes(byte[] srcBuf, int off, int len)Writes byte array.intwriteFully(ByteBuffer srcBuf)Writes a sequence of bytes to this file from thesourceBuffer.-
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
-
-
-
-
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 thesourceBuffer.- Specified by:
writeFullyin interfaceFileIO- Overrides:
writeFullyin classAbstractFileIO- 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 IOExceptionWrites byte array.- Throws:
IOException- If some I/O error occurs.
-
writeByte
protected void writeByte(byte b) throws IOExceptionWrites one byte.- Throws:
IOException- If some I/O error occurs.
-
close
public void close() throws IOExceptionCloses current file.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceFileIO- Overrides:
closein classFileIODecorator- Throws:
IOException- If some I/O error occurs.
-
-