Package google.registry.tools
Class LevelDbLogReader
- java.lang.Object
-
- google.registry.tools.LevelDbLogReader
-
- All Implemented Interfaces:
java.util.Iterator<byte[]>
public final class LevelDbLogReader extends java.lang.Object implements java.util.Iterator<byte[]>
Iterator that incrementally parses binary data in LevelDb format into records.The input source is automatically closed when all data have been read.
There are several other implementations of this, none of which appeared suitable for our use case: The original C++ implementation. com.google.appengine.api.files.RecordReadChannel - Exactly what we need but deprecated. The referenced replacement: The App Engine GCS Client - Does not appear to have any support for working with LevelDB. *
See log_format.md
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static LevelDbLogReader
from(java.io.InputStream source)
Returns aLevelDbLogReader
over anInputStream
.static LevelDbLogReader
from(java.lang.String filename)
Returns aLevelDbLogReader
over a file specified byfilename
.static LevelDbLogReader
from(java.nio.channels.ReadableByteChannel channel)
Returns aLevelDbLogReader
over aReadableByteChannel
.static LevelDbLogReader
from(java.nio.file.Path path)
Returns aLevelDbLogReader
over a file specified byPath
.boolean
hasNext()
byte[]
next()
-
-
-
Method Detail
-
hasNext
public boolean hasNext()
- Specified by:
hasNext
in interfacejava.util.Iterator<byte[]>
-
next
public byte[] next()
- Specified by:
next
in interfacejava.util.Iterator<byte[]>
-
from
public static LevelDbLogReader from(java.nio.channels.ReadableByteChannel channel)
Returns aLevelDbLogReader
over aReadableByteChannel
.
-
from
public static LevelDbLogReader from(java.io.InputStream source)
Returns aLevelDbLogReader
over anInputStream
.
-
from
public static LevelDbLogReader from(java.nio.file.Path path) throws java.io.IOException
Returns aLevelDbLogReader
over a file specified byPath
.- Throws:
java.io.IOException
-
from
public static LevelDbLogReader from(java.lang.String filename) throws java.io.IOException
Returns aLevelDbLogReader
over a file specified byfilename
.- Throws:
java.io.IOException
-
-