Interface Descriptor

All Superinterfaces:
Serializable
All Known Subinterfaces:
BandwidthFile, BridgedbMetrics, BridgeExtraInfoDescriptor, BridgeNetworkStatus, BridgePoolAssignment, BridgeServerDescriptor, BridgestrapStats, DirectoryKeyCertificate, ExitList, ExtraInfoDescriptor, GeoipFile, GeoipNamesFile, LogDescriptor, Microdescriptor, RelayDirectory, RelayExtraInfoDescriptor, RelayNetworkStatus, RelayNetworkStatusConsensus, RelayNetworkStatusVote, RelayServerDescriptor, ServerDescriptor, SnowflakeStats, TorperfResult, UnparseableDescriptor, WebServerAccessLog

public interface Descriptor extends Serializable
Superinterface for any descriptor with access to generic information about the descriptor.
Since:
1.0.0
  • Method Summary

    Modifier and Type
    Method
    Description
    Return the (possibly empty) list of annotations in the format "@key( value)*".
    Return the file, tarball or plain file, that contained this descriptor, or null if this descriptor was not read from a file.
    byte[]
    Return the raw descriptor bytes.
    int
    Return the raw descriptor length in bytes.
    Return any unrecognized lines when parsing this descriptor, or an empty list if there were no unrecognized lines.
  • Method Details

    • getRawDescriptorBytes

      byte[] getRawDescriptorBytes()
      Return the raw descriptor bytes.

      This method creates a new copy of raw descriptor bytes from a potentially larger byte array containing multiple descriptors. Applications that only want to learn about raw descriptor length in bytes should instead use getRawDescriptorLength().

      Since:
      1.0.0
    • getRawDescriptorLength

      int getRawDescriptorLength()
      Return the raw descriptor length in bytes.

      Returns the exact same result as getRawDescriptorBytes().length, but much more efficiently.

      Since:
      1.9.0
    • getAnnotations

      List<String> getAnnotations()
      Return the (possibly empty) list of annotations in the format "@key( value)*".

      Some implementations might not support this operation and will throw an UnsupportedOperationException, e.g., UnparseableDescriptor.

      Since:
      1.0.0
    • getUnrecognizedLines

      List<String> getUnrecognizedLines()
      Return any unrecognized lines when parsing this descriptor, or an empty list if there were no unrecognized lines.

      Some implementations might not support this operation and will throw an UnsupportedOperationException, e.g., UnparseableDescriptor.

      Since:
      1.0.0
    • getDescriptorFile

      File getDescriptorFile()
      Return the file, tarball or plain file, that contained this descriptor, or null if this descriptor was not read from a file.
      Returns:
      Descriptor file that contained this descriptor.
      Since:
      1.9.0