Package mondrian.util
Class ByteString
- java.lang.Object
-
- mondrian.util.ByteString
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<ByteString>
public class ByteString extends java.lang.Object implements java.lang.Comparable<ByteString>, java.io.Serializable
Collection of bytes.ByteString is to bytes what
String
is to chars: It is immutable, implements equality (hashCode and equals), comparison (compareTo) and serialization correctly.- Author:
- jhyde
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ByteString(byte[] bytes)
Creates a ByteString.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte
byteAt(int i)
Returns the byte at a given position in the byte string.java.lang.Object
clone()
int
compareTo(ByteString that)
boolean
equals(java.lang.Object obj)
int
hashCode()
int
length()
Returns the number of bytes in this byte string.java.lang.String
toString()
Returns this byte string in hexadecimal format.
-
-
-
Method Detail
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
compareTo
public int compareTo(ByteString that)
- Specified by:
compareTo
in interfacejava.lang.Comparable<ByteString>
-
toString
public java.lang.String toString()
Returns this byte string in hexadecimal format.- Overrides:
toString
in classjava.lang.Object
- Returns:
- Hexadecimal string
-
clone
public java.lang.Object clone()
- Overrides:
clone
in classjava.lang.Object
-
length
public int length()
Returns the number of bytes in this byte string.- Returns:
- Length of this byte string
-
byteAt
public byte byteAt(int i)
Returns the byte at a given position in the byte string.- Parameters:
i
- Index- Returns:
- Byte at given position
- Throws:
java.lang.IndexOutOfBoundsException
- if the index argument is negative or not less than length()
-
-