Package com.adobe.internal.util
Class ByteString
- java.lang.Object
 - 
- com.adobe.internal.util.ByteString
 
 
- 
- All Implemented Interfaces:
 ByteSequence,java.io.Serializable,java.lang.Comparable
public class ByteString extends java.lang.Object implements ByteSequence, java.lang.Comparable, java.io.Serializable
TheByteStringclass represents strings of bytes.- See Also:
 - Serialized Form
 
 
- 
- 
Constructor Summary
Constructors Constructor Description ByteString()Create aByteStringthat represents an empty byte sequence.ByteString(byte[] value)Create aByteStringthat represents the same byte sequence as that contained in a byte array.ByteString(byte[] value, int offset, int length)Create aByteStringthat represents the same byte sequence as that contained in a subsequence of a byte array.ByteString(ByteString original)Create aByteStringthat represents the same byte sequence as that represented by anotherByteString. 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description bytebyteAt(int index)Returns the byte at the specified index.intcompareTo(ByteString otherByteString)intcompareTo(java.lang.Object otherObject)ByteStringconcat(ByteString byteString)booleanequals(java.lang.Object otherObject)byte[]getBytes()Returns a byte array containing the bytes in this sequence in the same order as this sequence.voidgetBytes(int srcBegin, int srcEnd, byte[] dst, int dstBegin)Returns a byte array containing the bytes in this sequence in the same order as this sequence and within the bounds given.inthashCode()intlength()Returns the length of this byte sequence.ByteSequencesubSequence(int start, int end)Returns a new byte sequence that is a subsequence of this sequence.ByteStringsubstring(int begin, int end)java.lang.StringtoString() 
 - 
 
- 
- 
Constructor Detail
- 
ByteString
public ByteString()
Create aByteStringthat represents an empty byte sequence. 
- 
ByteString
public ByteString(ByteString original)
Create aByteStringthat represents the same byte sequence as that represented by anotherByteString.- Parameters:
 original-ByteStringto copy
 
- 
ByteString
public ByteString(byte[] value)
Create aByteStringthat represents the same byte sequence as that contained in a byte array. The byte array is copied and so subsequent modification of the byte array does not affect theByteString.- Parameters:
 value- the initial value of theByteString
 
- 
ByteString
public ByteString(byte[] value, int offset, int length)Create aByteStringthat represents the same byte sequence as that contained in a subsequence of a byte array. The subsequence is copied and so subsequent modification of the byte array does not affect theByteString.- Parameters:
 value- the initial value of theByteStringoffset- the offset in the array for the subsequencelength- the length of the subsequence
 
 - 
 
- 
Method Detail
- 
hashCode
public int hashCode()
- Overrides:
 hashCodein classjava.lang.Object
 
- 
byteAt
public byte byteAt(int index)
Description copied from interface:ByteSequenceReturns the byte at the specified index. An index ranges from zero to length() - 1. The first byte of the sequence is at index zero, the next at index one, and so on, as for array indexing.- Specified by:
 byteAtin interfaceByteSequence- Parameters:
 index- the index of the character to be returned- Returns:
 - the specified byte
 
 
- 
length
public int length()
Description copied from interface:ByteSequenceReturns the length of this byte sequence. The length is the number of bytes in the sequence.- Specified by:
 lengthin interfaceByteSequence- Returns:
 - the number of bytes in this sequence
 
 
- 
getBytes
public void getBytes(int srcBegin, int srcEnd, byte[] dst, int dstBegin)Description copied from interface:ByteSequenceReturns a byte array containing the bytes in this sequence in the same order as this sequence and within the bounds given. The length of the byte array will be equal to srcEnd - srcBegin + 1.- Specified by:
 getBytesin interfaceByteSequence- Parameters:
 srcBegin- the byte to start copying fromsrcEnd- the byte to end copying atdst- the destination to copy the bytes todstBegin- the byte in the destination to begin the copying
 
- 
getBytes
public byte[] getBytes()
Description copied from interface:ByteSequenceReturns a byte array containing the bytes in this sequence in the same order as this sequence. The length of the byte array will be the length of this sequence.- Specified by:
 getBytesin interfaceByteSequence- Returns:
 - a byte array consisting of exactly this sequence of bytes
 
 
- 
subSequence
public ByteSequence subSequence(int start, int end)
Description copied from interface:ByteSequenceReturns a new byte sequence that is a subsequence of this sequence. The subsequence starts with the byte at the specified index and ends with the byte at index end - 1. The length of the returned sequence is end - start, so if start == end then an empty sequence is returned.- Specified by:
 subSequencein interfaceByteSequence- Parameters:
 start- the start index, inclusiveend- the end index, exclusive- Returns:
 - the specified subsequence
 
 
- 
substring
public ByteString substring(int begin, int end)
- Parameters:
 begin-end-- Returns:
 - a substring of this ByteString
 
 
- 
concat
public ByteString concat(ByteString byteString)
 
- 
compareTo
public int compareTo(java.lang.Object otherObject)
- Specified by:
 compareToin interfacejava.lang.Comparable
 
- 
compareTo
public int compareTo(ByteString otherByteString)
 
- 
equals
public boolean equals(java.lang.Object otherObject)
- Overrides:
 equalsin classjava.lang.Object
 
- 
toString
public java.lang.String toString()
- Overrides:
 toStringin classjava.lang.Object
 
 - 
 
 -