Package com.itextpdf.barcodes.qrcode
Class ByteArray
java.lang.Object
com.itextpdf.barcodes.qrcode.ByteArray
This class implements an array of unsigned bytes.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate byte[]
private static final int
private int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
appendByte
(int value) Append a byte to the end of the array.int
at
(int index) Access an unsigned byte at location index.boolean
isEmpty()
void
reserve
(int capacity) Increase the capacity of the array to "capacity" if the current capacity is smallervoid
set
(byte[] source, int offset, int count) Copy count bytes from array source starting at offset.void
set
(int index, int value) Set the value at "index" to "value"int
size()
-
Field Details
-
INITIAL_SIZE
private static final int INITIAL_SIZE- See Also:
-
bytes
private byte[] bytes -
size
private int size
-
-
Constructor Details
-
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 Details
-
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
-