Class IntArrayBuffer
java.lang.Object
com.oracle.truffle.regex.tregex.buffer.AbstractArrayBuffer
com.oracle.truffle.regex.tregex.buffer.IntArrayBuffer
- Direct Known Subclasses:
IntRangesBuffer,StringBufferUTF32
This class is designed as a "scratchpad" for generating many char arrays of unknown size. It will
never shrink its internal buffer, so it should be disposed as soon as it is no longer needed.
Usage Example:
IntArrayBuffer buf = new IntArrayBuffer();
List<int[]> results = new ArrayList<>();
for (Object obj : listOfThingsToProcess) {
for (Object x : obj.thingsThatShouldBecomeInts()) {
buf.add(someCalculation(x));
}
results.add(buf.toArray());
buf.clear();
}
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class com.oracle.truffle.regex.tregex.buffer.AbstractArrayBuffer
clear, ensureCapacity, isEmpty, length, setLengthMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
buf
protected int[] buf
-
-
Constructor Details
-
IntArrayBuffer
public IntArrayBuffer() -
IntArrayBuffer
public IntArrayBuffer(int initialSize)
-
-
Method Details
-
getBuffer
public int[] getBuffer() -
add
public void add(int c) -
asFixedSizeArray
-
get
public int get(int index) -
inc
public void inc(int index) -
set
public void set(int index, int value) -
addAll
-
getLast
public int getLast() -
removeLast
public int removeLast() -
toArray
public int[] toArray() -
iterator
-