public class ByteString extends Object implements Comparable<ByteString>, Serializable
ByteString is to bytes what String
is to chars: It is immutable,
implements equality (hashCode and equals), comparison (compareTo) and
serialization correctly.
Constructor and Description |
---|
ByteString(byte[] bytes)
Creates a ByteString.
|
Modifier and Type | Method and Description |
---|---|
byte |
byteAt(int i)
Returns the byte at a given position in the byte string.
|
Object |
clone() |
int |
compareTo(ByteString that) |
boolean |
equals(Object obj) |
int |
hashCode() |
int |
length()
Returns the number of bytes in this byte string.
|
String |
toString()
Returns this byte string in hexadecimal format.
|
public ByteString(byte[] bytes)
bytes
- Bytespublic int compareTo(ByteString that)
compareTo
in interface Comparable<ByteString>
public String toString()
public int length()
public byte byteAt(int i)
i
- IndexIndexOutOfBoundsException
- if the index argument is negative or not less than
length()Copyright © 2018 Hitachi Vantara. All rights reserved.