net.named_data.jndn
public static class Name.Component extends Object implements Comparable
Constructor and Description |
---|
Name.Component()
Create a new Name.Component with a zero-length value.
|
Name.Component(Blob value)
Create a new Name.Component, using the existing the Blob value.
|
Name.Component(byte[] value)
Create a new Name.Component, copying the given value.
|
Name.Component(Name.Component component)
Create a new Name.Component, taking another pointer to the component's
read-only value.
|
Name.Component(String value)
Create a new Name.Component, 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 |
fromNumber(long number)
Create a component 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 |
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).
|
Name.Component |
getSuccessor()
Get the successor of this component, as described in Name.getSuccessor.
|
Blob |
getValue()
Get the component value.
|
int |
hashCode() |
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 Name.Component()
public Name.Component(Blob value)
value
- The component value. value may not be null, but
value.buf() may be null.public Name.Component(Name.Component component)
component
- The component to copy.public Name.Component(byte[] value)
value
- The value byte array.public Name.Component(String value)
value
- The string to convert to UTF8.public final Blob getValue()
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 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 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 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 Comparable
public final int CompareTo(Object o)
Copyright © 2016. All rights reserved.