public interface DescriptorParser
Unlike most of the other descriptor sources this descriptor source does not operate in a batch-processing mode. It takes the raw descriptor contents of one or more descriptors, parses them, and returns a list of descriptors.
This descriptor source is internally used by other descriptor sources but can also be used directly by applications that obtain raw descriptor contents via other means than one of the existing descriptor sources.
Modifier and Type | Method and Description |
---|---|
java.lang.Iterable<Descriptor> |
parseDescriptors(byte[] rawDescriptorBytes,
java.io.File descriptorFile,
java.lang.String fileName)
Parse descriptors in the given byte array and return the parsed/unparseable
descriptors.
|
java.util.List<Descriptor> |
parseDescriptors(byte[] rawDescriptorBytes,
java.lang.String fileName)
Parse descriptors in the given byte array, possibly parsing the
publication time from the file name, depending on the descriptor
type.
|
void |
setFailUnrecognizedDescriptorLines(boolean failUnrecognizedDescriptorLines)
Deprecated.
Removed in an attempt to simplify the interface. Applications
that must fail descriptors with unrecognized lines can instead check
whether
Descriptor.getUnrecognizedLines() returns any lines. |
void setFailUnrecognizedDescriptorLines(boolean failUnrecognizedDescriptorLines)
Descriptor.getUnrecognizedLines()
returns any lines.This option is not set by default, because the Tor specifications allow for new lines to be added that shall be ignored by older Tor versions. But some applications may want to handle unrecognized descriptor lines explicitly.
java.util.List<Descriptor> parseDescriptors(byte[] rawDescriptorBytes, java.lang.String fileName) throws DescriptorParseException
DescriptorParseException
java.lang.Iterable<Descriptor> parseDescriptors(byte[] rawDescriptorBytes, java.io.File descriptorFile, java.lang.String fileName)
rawDescriptorBytes
- Raw descriptor bytes containing one or more
descriptorsdescriptorFile
- Optional descriptor file reference included in
parsed/unparseable descriptorsfileName
- Descriptor file name used for parsing the descriptor
publication time of some descriptor types