use of org.neo4j.kernel.impl.transaction.log.ReadableClosableChannel in project neo4j by neo4j.
the class InputEntityReader method readHeader.
private void readHeader(StoreChannel header) throws IOException {
try (ReadableClosableChannel reader = reader(header, (int) ByteUnit.kibiBytes(8))) {
int[] tokenIds = new int[HIGH_TOKEN_TYPE];
byte type;
while ((type = reader.get()) != END_OF_HEADER) {
int tokenId = tokenIds[type]++;
String name = (String) ValueType.stringType().read(reader);
tokens[type].put(tokenId, name);
}
}
}
use of org.neo4j.kernel.impl.transaction.log.ReadableClosableChannel in project neo4j by neo4j.
the class StateRecoveryManager method readLastEntryFrom.
private STATE readLastEntryFrom(File file) throws IOException {
try (ReadableClosableChannel channel = new ReadAheadChannel<>(fileSystem.open(file, "r"))) {
STATE result = null;
STATE lastRead;
try {
while ((lastRead = marshal.unmarshal(channel)) != null) {
result = lastRead;
}
} catch (EndOfStreamException e) {
// ignore; just use previous complete entry
}
return result;
}
}
Aggregations