bytearray with a Java API that includes equivalents to most
of the Python API. These Python equivalents accept a PyObject as argument, where you
might have expected a byte[] or PyByteArray, in order to accommodate
the full range of types accepted by the Python equivalent: usually, any PyObject
that implements BufferProtocol, providing a one-dimensional array of bytes, is an
acceptable argument. In the documentation, the reader will often see the terms "byte array" or
"object viewable as bytes" instead of bytearray when this broader scope is intended.
This may relate to parameters, or to the target object itself (in text that applies equally to
base or sibling classes).
| Modifier and Type | Field and Description |
|---|---|
| private WeakReference | export
Hold weakly a reference to a PyBuffer export not yet released, used to prevent untimely resizing. |
| public static final PyType |
| Access | Constructor and Description |
|---|---|
| public | PyByteArray(PyType
explicit Jython type type)Constructs a zero-length Python |
| public | |
| public | |
| public | PyByteArray(int[]
source of the bytes (and size) value)Constructs a |
| public | PyByteArray(BaseBytes
source of the bytes (and size) value)Constructs a new array filled exactly by a copy of the contents of the source, which is a
|
| pack-priv | PyByteArray(PyBuffer
source of the bytes (and size) value)Constructs a new array filled exactly by a copy of the contents of the source, which is a
byte-oriented |
| public | PyByteArray(BufferProtocol
source of the bytes (and size) value)Constructs a new array filled exactly by a copy of the contents of the source, which is an object supporting the Jython version of the PEP 3118 buffer API. |
| public | PyByteArray(Iterable<? extends PyObject>
source of the bytes (and size) value)Constructs a new array filled from an iterable of PyObject. |
| public | PyByteArray(PyString
primary argument from which value is taken arg, PyObject name of optional encoding (must be a string type) encoding, PyObject name of optional errors policy (must be a string type) errors)Constructs a new array by encoding a PyString argument to bytes. |
| public | PyByteArray(PyString
primary argument from which value is taken arg, String name of optional encoding (may be encoding, String null to select the default for
this installation)name of optional errors policy errors)Constructs a new array by encoding a PyString argument to bytes. |
| public | PyByteArray(PyString
primary argument from which value is taken arg)Constructs a new array by encoding a PyString argument to bytes. |
| public | PyByteArray(byte[]
pre-initialised with desired value: the caller should not keep a reference storage)Constructs a |
| public | PyByteArray(byte[]
pre-initialised with desired value: the caller should not keep a reference storage, int number of bytes actually used size)Constructs a |
| public | PyByteArray(PyObject
primary argument from which value is taken (may be arg)null)Constructs a new
|
| Modifier and Type | Method and Description |
|---|---|
| public PyObject | __add__(PyObject
the object to perform this binary operation with (the right-hand operand). o)Overrides org. Equivalent to the standard Python __add__ method. |
| public int | |
| public boolean | Returns: the result of the search.the element to search for in this o)bytearray.Overrides org. Implement to the standard Python __contains__ method, which in turn implements the
|
| public PyObject | __eq__(PyObject
the object to compare this with. other)Overrides org. Equivalent to the standard Python __eq__ method. |
| public PyObject | __ge__(PyObject
the object to compare this with. other)Overrides org. Equivalent to the standard Python __ge__ method. |
| public PyObject | __gt__(PyObject
the object to compare this with. other)Overrides org. Equivalent to the standard Python __gt__ method. |
| public PyObject | __iadd__(PyObject
the object to perform this binary operation with (the right-hand operand). o)Overrides org. Equivalent to the standard Python __iadd__ method. |
| public PyObject | __imul__(PyObject
the object to perform this binary operation with (the right-hand operand). n)Overrides org. Equivalent to the standard Python |
| public PyObject | __le__(PyObject
the object to compare this with. other)Overrides org. Equivalent to the standard Python __le__ method. |
| public PyObject | __lt__(PyObject
the object to compare this with. other)Overrides org. Equivalent to the standard Python __lt__ method. |
| public PyObject | __mul__(PyObject
the object to perform this binary operation with (the right-hand operand). n)Overrides org. Equivalent to the standard Python |
| public PyObject | __ne__(PyObject
the object to compare this with. other)Overrides org. Equivalent to the standard Python __ne__ method. |
| public PyString | __repr__()
Overrides org. Equivalent to the standard Python |
| public PyObject | __rmul__(PyObject
the object to perform this binary operation with (the left-hand operand). n)Overrides org. Equivalent to the standard Python |
| public PyString | __str__()
Overrides org. An overriding of the |
| public void | |
| public void | |
| pack-priv final synchronized PyObject | |
| pack-priv final int | |
| pack-priv final boolean | |
| pack-priv final synchronized PyObject | |
| pack-priv final synchronized PyObject | |
| pack-priv final synchronized PyObject | |
| pack-priv final synchronized PyObject | |
| pack-priv final int | |
| pack-priv final synchronized PyObject | |
| pack-priv final PyObject | |
| pack-priv final synchronized void | bytearray___init__(PyObject[]
argument array according to Jython conventions args, String[] Keywords according to Jython conventions kwds)Initialise a mutable |
| pack-priv final synchronized PyObject | |
| pack-priv final int | |
| pack-priv final synchronized PyObject | |
| pack-priv final PyObject | |
| pack-priv final synchronized PyObject | |
| pack-priv final PyObject | |
| pack-priv final synchronized PyString | |
| pack-priv final PyObject | |
| pack-priv final synchronized void | |
| pack-priv final synchronized void | |
| pack-priv final PyByteArray | |
| pack-priv final PyByteArray | |
| pack-priv final int | |
| pack-priv final PyObject | |
| pack-priv final boolean | |
| pack-priv final PyByteArray | |
| pack-priv final synchronized void | |
| pack-priv final int | |
| pack-priv static PyByteArray | |
| pack-priv final int | |
| pack-priv final synchronized void | |
| pack-priv final boolean | |
| pack-priv final boolean | |
| pack-priv final boolean | |
| pack-priv final boolean | |
| pack-priv final boolean | |
| pack-priv final boolean | |
| pack-priv final boolean | |
| pack-priv final PyByteArray | |
| pack-priv final PyByteArray | |
| pack-priv final PyByteArray | |
| pack-priv final synchronized PyByteArray | |
| pack-priv final PyTuple | |
| pack-priv final synchronized PyInteger | |
| pack-priv final synchronized void | |
| pack-priv final PyByteArray | |
| pack-priv final synchronized void | |
| pack-priv final int | |
| pack-priv final int | |
| pack-priv final PyByteArray | |
| pack-priv final PyTuple | |
| pack-priv final PyList | |
| pack-priv final synchronized PyByteArray | |
| pack-priv final PyList | |
| pack-priv final PyList | |
| pack-priv final boolean | |
| pack-priv final PyString | |
| pack-priv final synchronized PyByteArray | |
| pack-priv final PyByteArray | |
| pack-priv final PyByteArray | |
| pack-priv final PyByteArray | |
| pack-priv final PyByteArray | |
| pack-priv final PyByteArray | |
| public PyByteArray | Returns: new byte array containing resultdesired width)Java API equivalent of Python |
| public PyByteArray | |
| public int | |
| public int | |
| public int | |
| protected synchronized void | del(int
index of the element to delete. index)Overrides org. Deletes an element from the sequence (and closes up the gap). |
| protected synchronized void | delRange(int
the position of the first element. start, int one more than the position of the last element. stop)Overrides org. Deletes a contiguous sub-sequence (and closes up the gap). |
| protected synchronized void | delslice(int
the position of the first element. start, int beyond the position of the last element (not necessarily just beyond). stop, int from one element to the next (positive or negative) step, int number of elements to delete n)Overrides org. Deletes a simple or extended slice and closes up the gap(s). |
| public boolean | |
| public boolean | |
| public boolean | Returns: true if and only if this[start:end] ends with the suffix (or one of them)byte array to match, or object viewable as such, or a tuple of them suffix, PyObject of slice in this start, PyObject bytearray to matchof slice in this end)bytearray to matchImplementation of Python |
| public PyByteArray | Returns: copy of this byte array with tabs expandedImplementation of Python |
| public PyByteArray | Returns: copy of this byte array with tabs expandednumber of character positions between tab stops tabsize)Implementation of Python |
| public void | |
| public int | |
| public int | |
| public int | |
| pack-priv static PyByteArray | |
| public synchronized PyBuffer | getBuffer(int
specifying features demanded and the navigational capabilities of the consumer flags)Implements org. Method by which the consumer requests the buffer from the exporter. |
| private BaseBuffer | |
| protected PyByteArray | getResult(BaseBytes.
containing the result bImplements abstract org. Every sub-class of BaseBytes overrides this method to access a |
| protected synchronized PyByteArray | Returns: aPyByteArray corresponding the the given range of elements.the position of the first element. start, int one more than the position of the last element. stop, int the step size. step)Implements abstract org. Returns a slice of elements from this sequence as a |
| protected synchronized PyByteArray | getslice(int
the position of the first element. start, int one more than the position of the last element. stop)Overrides org. Specialisation of |
| private PyBuffer | Returns: the buffer view of the table or null if there is no tablethe translation table (or table)null or PyNone)Return a |
| public int | hashCode()
Overrides org. Implements java. This type is not hashable. |
| public int | |
| public int | |
| public int | |
| public void | |
| protected synchronized void | irepeat(int
the number of times to repeat this. count)Replace the contents of this |
| public PyByteArray | |
| public PyByteArray | Returns: new byte array containing resultdesired width)Java API equivalent of Python |
| public PyByteArray | |
| public PyByteArray | Returns: a byte array containing this value stripped of those bytesImplementation of Python |
| public PyByteArray | |
| protected void | newStorage(int
becomes the new value of this.size needed)Overrides org. Allocate fresh storage for at least the requested number of bytes. |
| private void | newStorage(int
length of storage array to allocate (decided by caller) L2, int length of A a, int gap between A and B in current storage layout d, int length of B b, int gap between A and B in new storage layout. e)Allocate new storage and copy two blocks from the current storage to it. |
| private void | newStorageAvoided(int
length of A a, int gap between A and B in current storage layout d, int length of B b, int gap between A and B in new storage layout. e)Use the existing storage but move two blocks within it to leave a gap of the required size. |
| public PyInteger | |
| public PyInteger | Returns: PyInteger representing the valuethe index of the byte to remove and return. i)Remove and return the |
| public synchronized void | pyinsert(int
to insert at index, PyObject to insert (by value) element)Overrides org. Insert the element (interpreted as a Python byte value) at the given index. |
| public synchronized void | pyset(int
index of the element to set. index, PyObject the value to set this element to. value)Overrides org. Sets the indexed element of the |
| private final int | Returns: recommended amount to allocatenumber of bytes needed needed)Recommend a length for (but don't allocate) a new storage array, taking into account the current length and the number of bytes now needed. |
| public void | |
| protected synchronized PyByteArray | Returns: this byte array repeated count times.the number of times to repeat this. count)Implements abstract org. Returns a |
| public PyByteArray | |
| public PyByteArray | Returns: result of replacement as a new PyByteArraysequence to find oldB, PyObject relacement sequence newB, int maximum occurrences are replaced or all if maxcount)maxcount < 0An implementation of Python |
| protected void | |
| public void | |
| public int | |
| public int | |
| public int | |
| public int | |
| public int | |
| public int | |
| public PyByteArray | Returns: new byte array containing resultdesired width)Java API equivalent of Python |
| public PyByteArray | |
| public PyByteArray | Returns: a byte array containing this value stripped of those bytes (at right)Implementation of Python |
| public PyByteArray | |
| protected synchronized void | setslice(int
the position of the first element. start, int one more than the position of the last element. stop, int the step size. step, PyObject an object consistent with the slice assignment value)Overrides org. Sets the given range of elements according to Python slice assignment semantics. |
| private void | setslice(int
the position of the first element. start, int one more than the position of the last element. stop, int the step size. step, int number of zeros to insert consistent with the slice assignment len)Sets the given range of elements according to Python slice assignment semantics from a
zero-filled |
| private void | setslice(int
the position of the first element. start, int one more than the position of the last element. stop, int the step size. step, PyString a PyString object consistent with the slice assignment value)Sets the given range of elements according to Python slice assignment semantics from a
|
| private void | setslice(int
the position of the first element. start, int one more than the position of the last element. stop, int the step size. step, BufferProtocol an object supporting the buffer API consistent with the slice assignment value)Sets the given range of elements according to Python slice assignment semantics from an object supporting the Jython implementation of PEP 3118. |
| private void | setslice(int
the position of the first element. start, int one more than the position of the last element. stop, int the step size. step, BaseBytes a value)bytearray (or bytes) object consistent with the slice assignmentSets the given range of elements according to Python slice assignment semantics from a
|
| private void | setslice(int
the position of the first element. start, int one more than the position of the last element. stop, int the step size. step, Iterable<? extends PyObject> iterable source of values to enter in the array iter)Sets the given range of elements according to Python slice assignment semantics from a
|
| private boolean | Returns: true if the slice was set successfully, false otherwisethe position of the first element. start, int one more than the position of the last element. stop, int the step size. step, PyObject an object possibly bearing the Buffer API value)Sets the given range of elements according to Python slice assignment semantics from an object that might support the Jython Buffer API. |
| public static PyException | Returns: PyException (ValueError) as detailedsize of sequence being assigned to slice valueSize, int size of slice expected to receive sliceSize)Convenience method to build (but not throw) a |
| public boolean | Returns: true if and only if thisbytearray starts with the prefix (or one of
them)byte array to match, or object viewable as such, or a tuple of them prefix)Implementation of Python |
| public boolean | Returns: true if and only if this[start:] starts with the prefix (or one of them)byte array to match, or object viewable as such, or a tuple of them prefix, PyObject of slice in this start)bytearray to matchImplementation of Python |
| public boolean | Returns: true if and only if this[start:end] starts with the prefix (or one of them)byte array to match, or object viewable as such, or a tuple of them prefix, PyObject of slice in this start, PyObject bytearray to matchof slice in this end)bytearray to matchImplementation of Python |
| private void | storageDelete(int
index of hole in byte array a, int number to discard (will discard x[a,a+d-1]) d)Delete |
| private void | storageExtend(int
size of hole to open (will be x[a, a+e-1]) where a = size before call e)Prepare to insert |
| private void | storageReplace(int
index of hole in byte array a, int number to discard (will discard x[a,a+d-1]) d, int size of hole to open (will be x[a, a+e-1]) e)Delete |
| public PyByteArray | Returns: a byte array containing this value stripped of those bytes (left and right)Implementation of Python |
| public PyByteArray | |
| public String | toString()
Overrides org. An overriding of the standard Java |
| public PyByteArray | |
| public PyByteArray | |
| public PyByteArray | Returns: left-filled byte arraydesired width)Implementation of Python |