use of com.baidu.hugegraph.computer.core.io.RandomAccessOutput in project hugegraph-computer by hugegraph.
the class StoreTestUtil method bufferFileFromKvMap.
public static void bufferFileFromKvMap(List<Integer> map, String path) throws IOException {
RandomAccessOutput output = IOFactory.createFileOutput(new File(path));
BytesInput buffer = SorterTestUtil.inputFromKvMap(map);
output.write(buffer.readBytes((int) buffer.available()));
output.close();
}
use of com.baidu.hugegraph.computer.core.io.RandomAccessOutput in project hugegraph-computer by hugegraph.
the class StoreTestUtil method bufferFileFromSubKvMap.
public static void bufferFileFromSubKvMap(List<List<Integer>> map, String path) throws IOException {
RandomAccessOutput output = IOFactory.createFileOutput(new File(path));
BytesInput buffer = SorterTestUtil.inputFromSubKvMap(map);
output.write(buffer.readBytes((int) buffer.available()));
output.close();
}
use of com.baidu.hugegraph.computer.core.io.RandomAccessOutput in project hugegraph-computer by hugegraph.
the class KvEntryWriterImpl method writeData.
private void writeData(Writable data) throws IOException {
RandomAccessOutput output;
if (this.needSort) {
assert this.subKvBuffer != null;
output = this.subKvBuffer;
} else {
output = this.output;
}
long position = output.position();
// Write data length placeholder
output.writeFixedInt(0);
// Write data
data.write(output);
// Fill data length placeholder
long dataLength = output.position() - position - Integer.BYTES;
output.writeFixedInt(position, (int) dataLength);
this.total += Integer.BYTES + dataLength;
}
use of com.baidu.hugegraph.computer.core.io.RandomAccessOutput in project hugegraph-computer by hugegraph.
the class KvEntryWriterImpl method writeData.
private void writeData(Writable data) throws IOException {
RandomAccessOutput output;
if (this.needSort) {
assert this.subKvBuffer != null;
output = this.subKvBuffer;
} else {
output = this.output;
}
long position = output.position();
// Write data length placeholder
output.writeFixedInt(0);
// Write data
data.write(output);
// Fill data length placeholder
long dataLength = output.position() - position - Integer.BYTES;
output.writeFixedInt(position, (int) dataLength);
this.total += Integer.BYTES + dataLength;
}
Aggregations