public abstract class ByteSequence extends Object implements Comparable<ByteSequence>
Constructor and Description |
---|
ByteSequence() |
Modifier and Type | Method and Description |
---|---|
abstract byte |
byteAt(int i)
Gets a byte within this sequence.
|
static int |
compareBytes(ByteSequence bs1,
ByteSequence bs2)
Compares the two given byte sequences, byte by byte, returning a negative, zero, or positive result if the first sequence is less than, equal to, or
greater than the second.
|
int |
compareTo(ByteSequence obs) |
boolean |
equals(Object o) |
abstract byte[] |
getBackingArray()
Gets the backing byte array for this sequence.
|
int |
hashCode() |
abstract boolean |
isBackedByArray()
Determines whether this sequence is backed by a byte array.
|
abstract int |
length()
Gets the length of this sequence.
|
abstract int |
offset()
Gets the offset for this sequence.
|
abstract ByteSequence |
subSequence(int start,
int end)
Returns a portion of this sequence.
|
abstract byte[] |
toArray()
Returns a byte array containing the bytes in this sequence.
|
public abstract byte byteAt(int i)
i
- index into sequenceIllegalArgumentException
- if i is out of rangepublic abstract int length()
public abstract ByteSequence subSequence(int start, int end)
start
- index of subsequence start (inclusive)end
- index of subsequence end (exclusive)public abstract byte[] toArray()
public abstract boolean isBackedByArray()
public abstract byte[] getBackingArray()
public abstract int offset()
public static int compareBytes(ByteSequence bs1, ByteSequence bs2)
bs1
- first byte sequence to comparebs2
- second byte sequence to comparepublic int compareTo(ByteSequence obs)
compareTo
in interface Comparable<ByteSequence>
Copyright © 2011–2018 The Apache Software Foundation. All rights reserved.