|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Object
|
+--java.util.AbstractCollection
|
+--java.util.AbstractList
|
+--java.util.Vector
|
+--com.adobe.acrobat.bytearray.ByteRange
Object used to describe subsets of ByteArrays. A ByteRange is really just a set of integers stored in a way optimized for the most common case, i.e., small numbers of comparatively large nonoverlapping sequences of byte-offsets (integers).
A ByteRange is a set of integers and as such supports all basic set operations, e.g., intersection, union, and subtraction.
ByteRanges contain integers ranging in value from 0 to Integer.MAX_VALUE-1. ByteRanges are also immutable; it is impossible to "change" the value of an instantiated ByteRange. Instead one must construct ByteRanges using the accessor methods for the empty and universal ByteRange, and the various ByteRange operator methods.
| Fields inherited from class java.util.Vector |
capacityIncrement, elementCount, elementData |
| Fields inherited from class java.util.AbstractList |
modCount |
| Constructor Summary |
ByteRange(ContiguousByteRange cbr) Create a ByteRange which delimits all the integers in the given ContiguousByteRange. |
ByteRange(int start,
int end) Create a ByteRange which contains all the integers between start and end inclusive. |
ByteRange(java.lang.String s)
Create a new ByteRange based on a String representation. |
| Method Summary | |
int |
byteIndex(int n) Returns the number of integers in this ByteRange less than or equal to the given integer. |
boolean |
contains(ByteRange br) Returns true if the given ByteRange is completely enclosed in this ByteRange, i.e., every integer appearing in br
appears in this ByteRange. |
boolean |
contains(ContiguousByteRange cbr) Returns true if the ContiguousByteRange is completely enclosed in the ByteRange, i.e., every integer in cbr
in contained in this ByteRange. |
boolean |
contains(int n) Test the ByteRange for inclusion of a particular integer. |
ByteRange |
decapitate(int start)
Return a new ByteRange which contains all the integers in this ByteRange except those whose values are less than start. |
boolean |
equals(java.lang.Object o)
Determine if two ByteRanges are equal. |
static ByteRange |
getEmptyByteRange()
Get the empty ByteRange. |
ContiguousByteRange |
getEnclosingRange()
Get the ContiguousByteRange enclosing the entire ByteRange. |
int |
getEnd() Gets the last integer in the ByteRange. |
ContiguousByteRange |
getFirstIntersection(ContiguousByteRange br) Returns a Contiguous byte range that intersects this byte range |
int |
getLength() |
ContiguousByteRange |
getNthContiguousByteRange(int n)
Get the nth contiguous range. |
int |
getStart() Gets the first integer in a ByteRange. |
static ByteRange |
getUniversalByteRange()
Get the ByteRange that contains all integers from 0 to Integer.MAX_VALUE-. |
ByteRange |
intersect(ByteRange r2) Intersect a ByteRange with another ByteRange. |
boolean |
intersects(ByteRange br2) Returns true if the two ByteRanges have a non-empty intersection. |
boolean |
isUniversal() Returns true if every integer between 0 and Integer.MAX_VALUE-1 inclusive is included in this ByteRange. |
int |
numRanges() Get the number of continguous ranges in this ByteRange. |
ByteRange |
subtract(ByteRange subtractor) Subtract all the integers in subtractor
from this ByteRange, and return the result. |
ByteRange |
subtract(ContiguousByteRange subtractor) |
java.lang.String |
toRangeString() Create a string representation of this ByteRange. |
ByteRange |
truncate(int end) Return a new ByteRange which contains all the integers in this ByteRange except those whose values are greater than or equal to end. |
ByteRange |
union(ByteRange r2) Union a ByteRange with another ByteRange. |
ByteRange |
union(ContiguousByteRange cbr) |
| Methods inherited from class java.util.Vector |
add, add, addAll, addAll, addElement, capacity, clear, clone, contains,
containsAll, copyInto, elementAt, elements, ensureCapacity, firstElement, get, hashCode,
indexOf, indexOf, insertElementAt, isEmpty, lastElement, lastIndexOf, lastIndexOf, remove,
remove, removeAll, removeAllElements, removeElement, removeElementAt, removeRange,
retainAll, set, setElementAt, setSize, size, subList, toArray, toArray, toString,
trimToSize |
| Methods inherited from class java.util.AbstractList |
iterator, listIterator, listIterator |
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public ByteRange(ContiguousByteRange cbr)
cbr - the ContiguousByteRange being copied
public ByteRange(int start,
int end)
start - the first integer to be included in the ByteRangeend - the last integer to be included in the ByteRangepublic ByteRange(java.lang.String s)
s - the String from which to derive the contents of this ByteRange| Method Detail |
public static ByteRange getEmptyByteRange()
public static ByteRange getUniversalByteRange()
public boolean equals(java.lang.Object o)
o - the object whose value is being comparedpublic int getStart()
public int getEnd()
public int getLength()
public ByteRange truncate(int end)
end - the upper bound of the returned valueend.decapitatepublic ByteRange decapitate(int start)
start - the lower bound of the returned valuestart.truncatepublic ContiguousByteRange getFirstIntersection(ContiguousByteRange br)
public int numRanges()
public ContiguousByteRange getNthContiguousByteRange(int n)
n - the index of the requested contiguous range.public boolean isUniversal()
public int byteIndex(int n)
n - an integer whose ordinality within the integers contained in this
ByteRange is requestedn within this ByteRangenthBytepublic ContiguousByteRange getEnclosingRange()
public ByteRange union(ByteRange r2)
r2.r2 - the ByteRange to union with this ByteRanger2.public ByteRange union(ContiguousByteRange cbr)
public boolean contains(ContiguousByteRange cbr)
cbr in contained in this ByteRange.cbr - the ContiguousByteRange being testedcbr is completely contained in this ByteRangepublic boolean contains(ByteRange br)
br appears in this ByteRange.br - the ByteRange being testedbr is completely contained in this ByteRangepublic boolean contains(int n)
n - the integer being tested for inclusionn appears in this ByteRange, false otherwisepublic boolean intersects(ByteRange br2)
br2 - the ByteRange being tested for intersection with this ByteRangebr2public ByteRange intersect(ByteRange r2)
r2 - the ByteRange to be intersected with this ByteRanger2public ByteRange subtract(ByteRange subtractor)
subtractor from this ByteRange, and return the
result.subtractor - the ByteRange to be subtracted from this ByteRangepublic ByteRange subtract(ContiguousByteRange subtractor)
public java.lang.String toRangeString()
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||