Class AbstractBufferedFileOutput
- java.lang.Object
-
- org.apache.hugegraph.computer.core.io.UnsafeBytesOutput
-
- org.apache.hugegraph.computer.core.io.AbstractBufferedFileOutput
-
- All Implemented Interfaces:
java.io.Closeable,java.io.DataOutput,java.lang.AutoCloseable,org.apache.hugegraph.computer.core.io.BytesOutput,org.apache.hugegraph.computer.core.io.RandomAccessOutput
- Direct Known Subclasses:
BufferedFileOutput,ValueFileOutput
public abstract class AbstractBufferedFileOutput extends UnsafeBytesOutput
-
-
Field Summary
Fields Modifier and Type Field Description protected longfileOffset
-
Constructor Summary
Constructors Constructor Description AbstractBufferedFileOutput(int bufferCapacity)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected intbufferAvailable()protected intbufferCapacity()protected intbufferSize()protected abstract voidflushBuffer()longposition()protected voidrequire(int size)longskip(long bytesToSkip)If you write some thing, and you need to write the serialized byte size first.voidwriteFixedInt(long position, int v)-
Methods inherited from class org.apache.hugegraph.computer.core.io.UnsafeBytesOutput
buffer, close, require, seek, toByteArray, write, write, write, write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFixedInt, writeFloat, writeInt, writeLong, writeShort, writeUTF
-
-
-
-
Method Detail
-
writeFixedInt
public void writeFixedInt(long position, int v) throws java.io.IOException- Specified by:
writeFixedIntin interfaceorg.apache.hugegraph.computer.core.io.RandomAccessOutput- Overrides:
writeFixedIntin classUnsafeBytesOutput- Throws:
java.io.IOException
-
position
public long position()
- Specified by:
positionin interfaceorg.apache.hugegraph.computer.core.io.RandomAccessOutput- Overrides:
positionin classUnsafeBytesOutput
-
skip
public long skip(long bytesToSkip) throws java.io.IOExceptionDescription copied from class:UnsafeBytesOutputIf you write some thing, and you need to write the serialized byte size first. If the byte size is unknown when write, you can skip 4 bytes (size of int)first, after write out the content, get the serialized byte size and calls writeInt(int position, int v) to write the int at skipped position. The serialized byte size can be get by the difference ofUnsafeBytesOutput.position()before and after write the content.- Specified by:
skipin interfaceorg.apache.hugegraph.computer.core.io.RandomAccessOutput- Overrides:
skipin classUnsafeBytesOutput- Returns:
- the position before skip.
- Throws:
java.io.IOException
-
require
protected void require(int size) throws java.io.IOException- Overrides:
requirein classUnsafeBytesOutput- Throws:
java.io.IOException
-
bufferSize
protected int bufferSize()
-
bufferAvailable
protected int bufferAvailable()
-
bufferCapacity
protected int bufferCapacity()
-
flushBuffer
protected abstract void flushBuffer() throws java.io.IOException- Throws:
java.io.IOException
-
-