public static class Name.Component extends Object implements Comparable
| Constructor and Description |
|---|
Component()
Create a new GENERIC Name.Component with a zero-length value.
|
Component(Blob value)
Create a new GENERIC Name.Component, using the existing the Blob value.
|
Component(Blob value,
ComponentType type)
Create a Name.Component of the given type, using the existing the Blob
value.
|
Component(Blob value,
ComponentType type,
int otherTypeCode)
Create a Name.Component of the given type, using the existing the Blob
value.
|
Component(byte[] value)
Create a new GENERIC Name.Component, copying the given value.
|
Component(byte[] value,
ComponentType type)
Create a Name.Component of the given type, copying the given value.
|
Component(byte[] value,
ComponentType type,
int otherTypeCode)
Create a Name.Component of the given type, copying the given value.
|
Component(Name.Component component)
Create a new Name.Component, taking another pointer to the component's
read-only value.
|
Component(String value)
Create a new GENERIC Name.Component, converting the value to UTF8 bytes.
|
Component(String value,
ComponentType type)
Create a Name.Component of the given type, converting the value to UTF8
bytes.
|
Component(String value,
ComponentType type,
int otherTypeCode)
Create a Name.Component of the given type, converting the value to UTF8
bytes.
|
| Modifier and Type | Method and Description |
|---|---|
int |
compare(Name.Component other)
Compare this to the other Component using NDN canonical ordering.
|
int |
compareTo(Object o) |
int |
CompareTo(Object o) |
boolean |
equals(Name.Component other)
Check if this is the same component as other.
|
boolean |
equals(Object other) |
static Name.Component |
fromImplicitSha256Digest(Blob digest)
Create a component of type ImplicitSha256DigestComponent, so that
isImplicitSha256Digest() is true.
|
static Name.Component |
fromImplicitSha256Digest(byte[] digest)
Create a component of type ImplicitSha256DigestComponent, so that
isImplicitSha256Digest() is true.
|
static Name.Component |
fromNumber(long number)
Create a component whose value is the nonNegativeInteger encoding of the
number.
|
static Name.Component |
fromNumber(long number,
ComponentType type)
Create a component of the given type whose value is the
nonNegativeInteger encoding of the number.
|
static Name.Component |
fromNumber(long number,
ComponentType type,
int otherTypeCode)
Create a component of the given type whose value is the
nonNegativeInteger encoding of the number.
|
static Name.Component |
fromNumberWithMarker(long number,
int marker)
Create a component whose value is the marker appended with the
nonNegativeInteger encoding of the number.
|
static Name.Component |
fromParametersSha256Digest(Blob digest)
Create a component of type ParametersSha256DigestComponent, so that
isParametersSha256Digest() is true.
|
static Name.Component |
fromParametersSha256Digest(byte[] digest)
Create a component of type ParametersSha256DigestComponent, so that
isParametersSha256Digest() is true.
|
static Name.Component |
fromSegment(long segment)
Create a component with the encoded segment number according to NDN
naming conventions for "Segment number" (marker 0x00).
|
static Name.Component |
fromSegmentOffset(long segmentOffset)
Create a component with the encoded segment byte offset according to NDN
naming conventions for segment "Byte offset" (marker 0xFB).
|
static Name.Component |
fromSequenceNumber(long sequenceNumber)
Create a component with the encoded sequence number according to NDN naming
conventions for "Sequencing" (marker 0xFE).
|
static Name.Component |
fromTimestamp(long timestamp)
Create a component with the encoded timestamp according to NDN naming
conventions for "Timestamp" (marker 0xFC).
|
static Name.Component |
fromVersion(long version)
Create a component with the encoded version number according to NDN
naming conventions for "Versioning" (marker 0xFD).
|
int |
getOtherTypeCode()
Get the component type code from the packet which is other than a
recognized ComponentType enum value.
|
Name.Component |
getSuccessor()
Get the successor of this component, as described in Name.getSuccessor.
|
ComponentType |
getType()
Get the name component type.
|
Blob |
getValue()
Get the component value.
|
int |
hashCode() |
boolean |
isGeneric()
Check if this component is a generic component.
|
boolean |
isImplicitSha256Digest()
Check if this component is an ImplicitSha256Digest component.
|
boolean |
isParametersSha256Digest()
Check if this component is a ParametersSha256Digest component.
|
boolean |
isSegment()
Check if this component is a segment number according to NDN naming
conventions for "Segment number" (marker 0x00).
|
boolean |
isSegmentOffset()
Check if this component is a segment byte offset according to NDN
naming conventions for segment "Byte offset" (marker 0xFB).
|
boolean |
isSequenceNumber()
Check if this component is a sequence number according to NDN naming
conventions for "Sequencing" (marker 0xFE).
|
boolean |
isTimestamp()
Check if this component is a timestamp according to NDN naming
conventions for "Timestamp" (marker 0xFC).
|
boolean |
isVersion()
Check if this component is a version number according to NDN naming
conventions for "Versioning" (marker 0xFD).
|
String |
toEscapedString()
Convert this component value by escaping characters according to the
NDN URI Scheme.
|
void |
toEscapedString(StringBuffer result)
Write this component value to result, escaping characters according to
the NDN URI Scheme.
|
long |
toNumber()
Interpret this name component as a network-ordered number and return an
integer.
|
long |
toNumberWithMarker(int marker)
Interpret this name component as a network-ordered number with a marker
and return an integer.
|
long |
toSegment()
Interpret this name component as a segment number according to NDN naming
conventions for "Segment number" (marker 0x00).
|
long |
toSegmentOffset()
Interpret this name component as a segment byte offset according to NDN
naming conventions for segment "Byte offset" (marker 0xFB).
|
long |
toSequenceNumber()
Interpret this name component as a sequence number according to NDN naming
conventions for "Sequencing" (marker 0xFE).
|
long |
toTimestamp()
Interpret this name component as a timestamp according to NDN naming
conventions for "Timestamp" (marker 0xFC).
|
long |
toVersion()
Interpret this name component as a version number according to NDN naming
conventions for "Versioning" (marker 0xFD).
|
public Component()
public Component(Blob value)
value - The component value. value may not be null, but
value.buf() may be null.public Component(Blob value, ComponentType type)
value - The component value. value may not be null, but value.buf()
may be null.type - The component type enum value. If the name component type is
not a recognized ComponentType enum value, call
Name.Component(value, ComponentType.OTHER_CODE, otherTypeCode).public Component(Blob value, ComponentType type, int otherTypeCode)
value - The component value. value may not be null, but value.buf()
may be null.type - The component type enum value. If name component type is not
a recognized ComponentType enum value, then set this to
ComponentType.OTHER_CODE and use the otherTypeCode parameter.otherTypeCode - If type is ComponentType.OTHER_CODE,
then this is the packet's unrecognized content type code, which must be
non-negative.public Component(Name.Component component)
component - The component to copy.public Component(byte[] value)
value - The value byte array.public Component(byte[] value,
ComponentType type)
value - The value byte array.type - The component type enum value. If the name component type is
not a recognized ComponentType enum value, call
Name.Component(value, ComponentType.OTHER_CODE, otherTypeCode).public Component(byte[] value,
ComponentType type,
int otherTypeCode)
value - The value byte array.type - The component type enum value. If name component type is not
a recognized ComponentType enum value, then set this to
ComponentType.OTHER_CODE and use the otherTypeCode parameter.otherTypeCode - If type is ComponentType.OTHER_CODE,
then this is the packet's unrecognized content type code, which must be
non-negative.public Component(String value)
value - The string to convert to UTF8.public Component(String value, ComponentType type)
value - The string to convert to UTF8.type - The component type enum value. If the name component type is
not a recognized ComponentType enum value, call
Name.Component(value, ComponentType.OTHER_CODE, otherTypeCode).public Component(String value, ComponentType type, int otherTypeCode)
value - The string to convert to UTF8.type - The component type enum value. If name component type is not
a recognized ComponentType enum value, then set this to
ComponentType.OTHER_CODE and use the otherTypeCode parameter.otherTypeCode - If type is ComponentType.OTHER_CODE,
then this is the packet's unrecognized content type code, which must be
non-negative.public final Blob getValue()
public final ComponentType getType()
public final int getOtherTypeCode()
public final void toEscapedString(StringBuffer result)
result - The StringBuffer to write to.public final String toEscapedString()
public final boolean isSegment()
public final boolean isSegmentOffset()
public final boolean isVersion()
public final boolean isTimestamp()
public final boolean isSequenceNumber()
public final boolean isGeneric()
public final boolean isImplicitSha256Digest()
public final boolean isParametersSha256Digest()
public final long toNumber()
public final long toNumberWithMarker(int marker)
throws EncodingException
marker - The required first byte of the component.EncodingException - If the first byte of the component does not
equal the marker.public final long toSegment()
throws EncodingException
EncodingException - If the first byte of the component is not the
expected marker.public final long toSegmentOffset()
throws EncodingException
EncodingException - If the first byte of the component is not the
expected marker.public final long toVersion()
throws EncodingException
EncodingException - If the first byte of the component is not the
expected marker.public final long toTimestamp()
throws EncodingException
EncodingException - If the first byte of the component is not the
expected marker.public final long toSequenceNumber()
throws EncodingException
EncodingException - If the first byte of the component is not the
expected marker.public static Name.Component fromNumber(long number)
number - The number to be encoded.public static Name.Component fromNumber(long number, ComponentType type)
number - The number to be encoded.type - The component type enum value. If the name component type is
not a recognized ComponentType enum value, call
fromNumber(number, ComponentType.OTHER_CODE, otherTypeCode).public static Name.Component fromNumber(long number, ComponentType type, int otherTypeCode)
number - The number to be encoded.type - The component type enum value. If name component type is not
a recognized ComponentType enum value, then set this to
ComponentType.OTHER_CODE and use the otherTypeCode parameter.otherTypeCode - If type is ComponentType.OTHER_CODE,
then this is the packet's unrecognized content type code, which must be
non-negative.public static Name.Component fromNumberWithMarker(long number, int marker)
number - The number to be encoded.marker - The marker to use as the first byte of the component.public static Name.Component fromSegment(long segment)
segment - The segment number.public static Name.Component fromSegmentOffset(long segmentOffset)
segmentOffset - The segment byte offset.public static Name.Component fromVersion(long version)
version - The version number.public static Name.Component fromTimestamp(long timestamp)
timestamp - The number of microseconds since the UNIX epoch (Thursday,
1 January 1970) not counting leap seconds.public static Name.Component fromSequenceNumber(long sequenceNumber)
sequenceNumber - The sequence number.public static Name.Component fromImplicitSha256Digest(Blob digest) throws EncodingException
digest - The SHA-256 digest value.EncodingException - If the digest length is not 32 bytes.public static Name.Component fromImplicitSha256Digest(byte[] digest) throws EncodingException
digest - The SHA-256 digest value.EncodingException - If the digest length is not 32 bytes.public static Name.Component fromParametersSha256Digest(Blob digest) throws EncodingException
digest - The SHA-256 digest value.EncodingException - If the digest length is not 32 bytes.public static Name.Component fromParametersSha256Digest(byte[] digest) throws EncodingException
digest - The SHA-256 digest value.EncodingException - If the digest length is not 32 bytes.public final Name.Component getSuccessor()
public final boolean equals(Name.Component other)
other - The other Component to compare with.public final int compare(Name.Component other)
other - The other Component to compare with.public final int compareTo(Object o)
compareTo in interface Comparablepublic final int CompareTo(Object o)
Copyright © 2019. All rights reserved.