|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectuk.org.blankaspect.nlf.Attributes.Attr
public static class Attributes.Attr
This class implements an attribute name-value pair. An attributes chunk consists of a list of name-value pairs.
Constructor Summary | |
---|---|
Attributes.Attr(java.lang.String name)
Constructs an attribute name-value pair with the specified name. |
|
Attributes.Attr(java.lang.String name,
java.lang.String value)
Constructs an attribute name-value pair with the specified name and value. |
Method Summary | |
---|---|
int |
compareTo(Attributes.Attr attr)
Compares this attribute with the specified Attr object. |
boolean |
equals(java.lang.Object obj)
Compares this attribute with the specified object. |
byte[] |
getBytes(boolean littleEndian)
Returns this Attr object in its encoded form (ie, in the form in which it is encoded in
an attributes chunk in a Nested List File). |
java.lang.String |
getName()
Returns the name of the attribute. |
int |
getSize()
Returns the size of this Attr object in its encoded form (ie, in the form in which it is
encoded in an attributes chunk in a Nested List File). |
java.lang.String |
getValue()
Returns the value of the attribute. |
int |
hashCode()
Returns the hash code for this object. |
java.lang.String |
toString()
Returns the attribute as a string. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Attributes.Attr(java.lang.String name) throws java.lang.IllegalArgumentException
name
- the attribute name.
java.lang.IllegalArgumentException
- if
name
is null
, orname
is greater than 65535 bytes,
orname
is not a valid attribute name.public Attributes.Attr(java.lang.String name, java.lang.String value) throws java.lang.IllegalArgumentException
name
- the attribute name.value
- the attribute value.
java.lang.IllegalArgumentException
- if
name
is null
, orname
is greater than 65535 bytes,
orname
is not a valid attribute name, orvalue
is null
, orvalue
is greater than 65535
bytes.Method Detail |
---|
public int compareTo(Attributes.Attr attr)
Attr
object. The comparison is performed by
comparing the names of the two objects using java.lang.String.compareTo(java.lang.String)
, which compares strings lexicographically by the
Unicode value of each character in the strings.
The result is
Note that a result of zero does not imply that the equals(Object)
method would return true
, although the converse is true.
compareTo
in interface java.lang.Comparable<Attributes.Attr>
attr
- the Attr
object with which the comparison is to be made.
0
(zero) if the name of this attribute is equal to the name of attr
;0
if the name of this attribute is lexicographically less
than the name of attr
;0
if the name of this attribute is lexicographically
greater than the name of attr
.String.compareTo(java.lang.String)
public boolean equals(java.lang.Object obj)
true
if and only if
obj
is an Attr
object that has the same name and value as this object.
equals
in class java.lang.Object
obj
- the object with which the comparison is to be made.
true
if obj
is an Attr
object with the same name and value as
this object; false
otherwise.public int hashCode()
hashCode
in class java.lang.Object
equals(Object)
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getName()
public java.lang.String getValue()
public int getSize()
Attr
object in its encoded form (ie, in the form in which it is
encoded in an attributes chunk in a Nested List File). The name and value of the attribute are
each encoded as two size bytes followed by a UTF-8 sequence.
Attr
object in its encoded form.getBytes(boolean)
public byte[] getBytes(boolean littleEndian)
Attr
object in its encoded form (ie, in the form in which it is encoded in
an attributes chunk in a Nested List File). The name and value of the attribute are each encoded
as two size bytes followed by a UTF-8 sequence.
littleEndian
- true
if the byte order of the size of the name and value is
little-endian; false
if the byte order of the size of the name and
value is big-endian.
Attr
object in its encoded form.getSize()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |