Package com.itextpdf.barcodes.qrcode
Class ByteArray
- java.lang.Object
-
- com.itextpdf.barcodes.qrcode.ByteArray
-
final class ByteArray extends java.lang.ObjectThis class implements an array of unsigned bytes.
-
-
Field Summary
Fields Modifier and Type Field Description private byte[]bytesprivate static intINITIAL_SIZEprivate intsize
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidappendByte(int value)Append a byte to the end of the array.intat(int index)Access an unsigned byte at location index.booleanisEmpty()voidreserve(int capacity)Increase the capacity of the array to "capacity" if the current capacity is smallervoidset(byte[] source, int offset, int count)Copy count bytes from array source starting at offset.voidset(int index, int value)Set the value at "index" to "value"intsize()
-
-
-
Field Detail
-
INITIAL_SIZE
private static final int INITIAL_SIZE
- See Also:
- Constant Field Values
-
bytes
private byte[] bytes
-
size
private int size
-
-
Constructor Detail
-
ByteArray
public ByteArray()
Creates a new ByteArray instance with size 0.
-
ByteArray
public ByteArray(int size)
Creates a new ByteArray instance of the specified size.- Parameters:
size- size of the array
-
ByteArray
public ByteArray(byte[] byteArray)
Creates a new ByteArray instance based on an existing byte[].- Parameters:
byteArray- the byte[]
-
-
Method Detail
-
at
public int at(int index)
Access an unsigned byte at location index.- Parameters:
index- The index in the array to access.- Returns:
- The unsigned value of the byte as an int.
-
set
public void set(int index, int value)Set the value at "index" to "value"- Parameters:
index- position in the byte-arrayvalue- new value
-
size
public int size()
- Returns:
- size of the array
-
isEmpty
public boolean isEmpty()
- Returns:
- true if size is equal to 0, false otherwise
-
appendByte
public void appendByte(int value)
Append a byte to the end of the array. If the array is too small, it's capacity is doubled.- Parameters:
value- byte to append.
-
reserve
public void reserve(int capacity)
Increase the capacity of the array to "capacity" if the current capacity is smaller- Parameters:
capacity- the new capacity
-
set
public void set(byte[] source, int offset, int count)Copy count bytes from array source starting at offset.- Parameters:
source- source of the copied bytesoffset- offset to start atcount- number of bytes to copy
-
-