Package org.torproject.descriptor
Interface LogDescriptor
-
- All Superinterfaces:
Descriptor
,java.io.Serializable
- All Known Subinterfaces:
WebServerAccessLog
public interface LogDescriptor extends Descriptor
Contains a log file.Unlike other descriptors, logs can get very large and are typically stored on disk in compressed form. Access to log contents through this interface and its subinterfaces is made available in compressed and decompressed form:
- The raw descriptor bytes are compressed, because logs contain often redundant information that can achieve high compression rates. For example, a 500kB compressed log file might be deflated to 3GB.
- The uncompressed log contents can be accessed as a stream of bytes.
- A list of log lines (decompressed) can be retrieved.
- Since:
- 2.2.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
LogDescriptor.Line
Base interface for accessing log lines.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.io.InputStream
decompressedByteStream()
Returns the decompressed raw descriptor bytes of the log as stream.java.util.List<java.lang.String>
getAnnotations()
Returns annotations found in the log file, which may be an empty List if a log format does not support adding annotations.byte[]
getRawDescriptorBytes()
Returns the raw compressed descriptor bytes of the log.java.util.List<java.lang.String>
getUnrecognizedLines()
Returns unrecognized lines encountered while parsing the log, which may be an empty list or a fixed-size list with only a few entries, depending on the log type.java.util.stream.Stream<? extends LogDescriptor.Line>
logLines()
Returns a stream of all parseable log lines.-
Methods inherited from interface org.torproject.descriptor.Descriptor
getDescriptorFile, getRawDescriptorLength
-
-
-
-
Method Detail
-
getRawDescriptorBytes
byte[] getRawDescriptorBytes()
Returns the raw compressed descriptor bytes of the log.For access to the log's decompressed bytes of use method
decompressedByteStream
.- Specified by:
getRawDescriptorBytes
in interfaceDescriptor
- Since:
- 2.2.0
-
decompressedByteStream
java.io.InputStream decompressedByteStream() throws DescriptorParseException
Returns the decompressed raw descriptor bytes of the log as stream.- Throws:
DescriptorParseException
- Since:
- 2.2.0
-
getAnnotations
java.util.List<java.lang.String> getAnnotations()
Returns annotations found in the log file, which may be an empty List if a log format does not support adding annotations.- Specified by:
getAnnotations
in interfaceDescriptor
- Since:
- 2.2.0
-
getUnrecognizedLines
java.util.List<java.lang.String> getUnrecognizedLines()
Returns unrecognized lines encountered while parsing the log, which may be an empty list or a fixed-size list with only a few entries, depending on the log type.- Specified by:
getUnrecognizedLines
in interfaceDescriptor
- Since:
- 2.2.0
-
logLines
java.util.stream.Stream<? extends LogDescriptor.Line> logLines() throws DescriptorParseException
Returns a stream of all parseable log lines.Depending on log size this might not fit into a collection type.
- Throws:
DescriptorParseException
- Since:
- 2.2.0
-
-