net.named_data.jndn
public class Name extends Object implements ChangeCountable, Comparable
| Modifier and Type | Class and Description |
|---|---|
static class |
Name.Component
A Name.Component holds a read-only name component value.
|
| Constructor and Description |
|---|
Name()
Create a new Name with no components.
|
Name(ArrayList components)
Create a new Name, copying the components.
|
Name(Name.Component[] components)
Create a new Name, copying the components.
|
Name(Name name)
Create a new Name with the components in the given name.
|
Name(String uri)
Parse the uri according to the NDN URI Scheme and create the name with the
components.
|
| Modifier and Type | Method and Description |
|---|---|
Name |
append(Blob value)
Append a new component, using the existing Blob value.
|
Name |
append(byte[] value)
Append a new component, copying from value.
|
Name |
append(Name.Component component)
Append the component to this name.
|
Name |
append(Name name) |
Name |
append(String value)
Convert the value to UTF8 bytes and append a Name.Component.
|
Name |
appendSegment(long segment)
Append a component with the encoded segment number according to NDN
naming conventions for "Segment number" (marker 0x00).
|
Name |
appendSegmentOffset(long segmentOffset)
Append a component with the encoded segment byte offset according to NDN
naming conventions for segment "Byte offset" (marker 0xFB).
|
Name |
appendSequenceNumber(long sequenceNumber)
Append a component with the encoded sequence number according to NDN naming
conventions for "Sequencing" (marker 0xFE).
|
Name |
appendTimestamp(long timestamp)
Append a component with the encoded timestamp according to NDN naming
conventions for "Timestamp" (marker 0xFC).
|
Name |
appendVersion(long version)
Append a component with the encoded version number according to NDN
naming conventions for "Versioning" (marker 0xFD).
|
void |
clear()
Clear all the components.
|
int |
compare(Name other)
Compare this to the other Name using NDN canonical ordering.
|
int |
compareTo(Object o) |
boolean |
equals(Object object)
Check if this name has the same component count and components as the given
name.
|
static Blob |
fromEscapedString(String escapedString)
Make a Blob value by decoding the escapedString according to the NDN URI
Scheme.
|
static Blob |
fromEscapedString(String escapedString,
int beginOffset,
int endOffset)
Make a Blob value by decoding the escapedString between beginOffset and
endOffset according to the NDN URI Scheme.
|
Name.Component |
get(int i)
Get the component at the given index.
|
long |
getChangeCount()
Get the change count, which is incremented each time this object is changed.
|
Name |
getPrefix(int nComponents)
Return a new Name with the first nComponents components of this Name.
|
Name |
getSubName(int iStartComponent)
Get a new name, constructed as a subset of components starting at
iStartComponent until the end of the name.
|
Name |
getSubName(int iStartComponent,
int nComponents)
Get a new name, constructed as a subset of components.
|
int |
hashCode() |
boolean |
match(Name name)
Check if the N components of this name are the same as the first N
components of the given name.
|
void |
set(String uri) |
int |
size()
Get the number of components.
|
static String |
toEscapedString(ByteBuffer value)
Convert the value by escaping characters according to the NDN URI Scheme.
|
static void |
toEscapedString(ByteBuffer value,
StringBuffer result)
Write the value to result, escaping characters according to the NDN URI
Scheme.
|
String |
toUri()
Encode this name as a URI according to the NDN URI Scheme.
|
String |
toUri(boolean includeScheme)
Encode this name as a URI according to the NDN URI Scheme.
|
void |
wireDecode(Blob input)
Decode the input using the default wire format
WireFormat.getDefaultWireFormat() and update this Name.
|
void |
wireDecode(Blob input,
WireFormat wireFormat)
Decode the input using a particular wire format and update this Name.
|
void |
wireDecode(ByteBuffer input)
Decode the input using the default wire format
WireFormat.getDefaultWireFormat() and update this Name.
|
void |
wireDecode(ByteBuffer input,
WireFormat wireFormat)
Decode the input using a particular wire format and update this Name.
|
Blob |
wireEncode()
Encode this Name for the default wire format
WireFormat.getDefaultWireFormat().
|
Blob |
wireEncode(WireFormat wireFormat)
Encode this Name for a particular wire format.
|
public Name()
public Name(Name name)
name - The name with components to copy from.public Name(ArrayList components)
components - The components to copy.public Name(Name.Component[] components)
components - The components to copy.public Name(String uri)
uri - The URI string.public final int size()
public final Name.Component get(int i)
i - The index of the component, starting from 0. However, if i is
negative, return the component at size() - (-i).public final void set(String uri)
public final void clear()
public final Name append(byte[] value)
value - The component value.public final Name append(Blob value)
value - The component value.public final Name append(Name.Component component)
component - The component to append.public final Name append(String value)
value - The string to convert to UTF8.public final Name getSubName(int iStartComponent, int nComponents)
iStartComponent - The index if the first component to get. If
iStartComponent is -N then return return components starting from
name.size() - N.nComponents - The number of components starting at iStartComponent.public final Name getSubName(int iStartComponent)
iStartComponent - The index if the first component to get. If
iStartComponent is -N then return return components starting from
name.size() - N.public final Name getPrefix(int nComponents)
nComponents - The number of prefix components. If nComponents is -N
then return the prefix up to name.size() - N. For example getPrefix(-1)
returns the name without the final component.public final String toUri(boolean includeScheme)
includeScheme - If true, include the "ndn:" scheme in the URI, e.g.
"ndn:/example/name". If false, just return the path, e.g. "/example/name",
which is normally the case where toUri() is used for display.public final String toUri()
public final Name appendSegment(long segment)
segment - The segment number.public final Name appendSegmentOffset(long segmentOffset)
segmentOffset - The segment byte offset.public final Name appendVersion(long version)
version - The version number.public final Name appendTimestamp(long timestamp)
timestamp - The number of microseconds since the UNIX epoch (Thursday,
1 January 1970) not counting leap seconds.public final Name appendSequenceNumber(long sequenceNumber)
sequenceNumber - The sequence number.public boolean equals(Object object)
public final boolean match(Name name)
name - The Name to check.public final Blob wireEncode(WireFormat wireFormat)
wireFormat - A WireFormat object used to encode this Name.public final Blob wireEncode()
public final void wireDecode(ByteBuffer input, WireFormat wireFormat) throws EncodingException
input - The input buffer to decode. This reads from position() to
limit(), but does not change the position.wireFormat - A WireFormat object used to decode the input.EncodingException - For invalid encoding.public final void wireDecode(ByteBuffer input) throws EncodingException
input - The input buffer to decode. This reads from position() to
limit(), but does not change the position.EncodingException - For invalid encoding.public final void wireDecode(Blob input, WireFormat wireFormat) throws EncodingException
input - The input blob to decode.wireFormat - A WireFormat object used to decode the input.EncodingException - For invalid encoding.public final void wireDecode(Blob input) throws EncodingException
input - The input blob to decode.EncodingException - For invalid encoding.public final int compare(Name other)
other - The other Name to compare with.public final int compareTo(Object o)
compareTo in interface Comparablepublic final long getChangeCount()
getChangeCount in interface ChangeCountablepublic static Blob fromEscapedString(String escapedString, int beginOffset, int endOffset)
escapedString - The escaped stringbeginOffset - The offset in escapedString of the beginning of the
portion to decode.endOffset - The offset in escapedString of the end of the portion to
decode.public static Blob fromEscapedString(String escapedString)
escapedString - The escaped string.public static void toEscapedString(ByteBuffer value, StringBuffer result)
value - The ByteBuffer with the value. This reads from position() to
limit().result - The StringBuffer to write to.public static String toEscapedString(ByteBuffer value)
value - The ByteBuffer with the value. This reads from position() to
limit().Copyright © 2015. All rights reserved.