PyBuffer,
including symbolic constants used by the consumer of a PyBuffer to specify its
requirements and assumptions. The Jython buffer API emulates the CPython buffer API. There are
two reasons for separating parts of PyBuffer into this interface:
PyBUF_SIMPLE, PyBUF_WRITABLE,
etc., and the trick of defining ours here means we can write PyBUF.SIMPLE,
PyBUF.WRITABLE, etc. so source code looks similar.byte array as storing anything
other than byte, and we prepare for the possibility of buffers with a series of different
primitive types by defining here those methods that would be in common between
(Byte)Buffer and an assumed future FloatBuffer or TypedBuffer<T>.
(Compare java.nio.Buffer.)PyBUF, except indirectly through other
interfaces. Users of the Jython buffer API can mostly overlook the distinction and just use
PyBuffer.
| Modifier and Type | Field and Description |
|---|---|
| public static final int | ANY_CONTIGUOUS
A constant used by the consumer in its call to |
| public static final int | AS_ARRAY
A constant used by the consumer in its call to |
| public static final int | C_CONTIGUOUS
A constant used by the consumer in its call to |
| public static final int | CONTIG
Equivalent to |
| public static final int | CONTIG_RO
Equivalent to |
| public static final int | CONTIGUITY
Field mask, used as in if |
| public static final int | F_CONTIGUOUS
A constant used by the consumer in its call to |
| public static final int | FORMAT
A constant used by the consumer in its call to |
| public static final int | FULL
Equivalent to |
| public static final int | FULL_RO
Equivalent to |
| public static final int | INDIRECT
A constant used by the consumer in its call to |
| public static final int | IS_C_CONTIGUOUS
A constant used by the exporter in processing |
| public static final int | IS_F_CONTIGUOUS
A constant used by the exporter in processing |
| public static final int | MAX_NDIM
The maximum allowed number of dimensions (CPython restriction). |
| public static final int | NAVIGATION
Field mask, used as in |
| public static final int | ND
A constant used by the consumer in its call to |
| public static final int | RECORDS
Equivalent to |
| public static final int | RECORDS_RO
Equivalent to |
| public static final int | SIMPLE
A constant used by the consumer in its call to |
| public static final int | STRIDED
Equivalent to |
| public static final int | STRIDED_RO
Equivalent to |
| public static final int | STRIDES
A constant used by the consumer in its call to |
| public static final int | WRITABLE
A constant used by the consumer in its call to |
| Modifier and Type | Method and Description |
|---|---|
| public int | Returns: the number of bytes comprising each item.The number of bytes stored in each indexable item. |
| public int | Returns: the total number of bytes represented.The total number of bytes represented by the view, which will be the product of the elements
of the |
| public int | |
| public int[] | Returns: the dimensions of the buffer as an arrayAn array reporting the size of the buffer, considered as a multidimensional array, in each dimension and (by its length) giving the number of dimensions. |
| public int[] | Returns: the distance in the storage array between adjacent items (in each dimension)The |
| public int[] | Returns: suboffsets array ornull if not necessary for navigationThe |
| public boolean | Returns: true iff the array is stored contiguously in the order specified'C', 'F' or 'A', as the storage order is C, Fortran or either. order)Enquire whether the array is represented contiguously in the backing storage, according to C or Fortran ordering. |
| public boolean | Returns: true if writing is not allowed, false if it is.Determine whether the consumer is entitled to write to the exported storage. |
| ANY_CONTIGUOUS | back to summary |
|---|---|
| public static final int ANY_CONTIGUOUS A constant used by the consumer in its call to | |
| AS_ARRAY | back to summary |
|---|---|
| public static final int AS_ARRAY A constant used by the consumer in its call to | |
| C_CONTIGUOUS | back to summary |
|---|---|
| public static final int C_CONTIGUOUS A constant used by the consumer in its call to | |
| CONTIG | back to summary |
|---|---|
| public static final int CONTIG Equivalent to | |
| CONTIG_RO | back to summary |
|---|---|
| public static final int CONTIG_RO Equivalent to | |
| CONTIGUITY | back to summary |
|---|---|
| public static final int CONTIGUITY Field mask, used as in if | |
| F_CONTIGUOUS | back to summary |
|---|---|
| public static final int F_CONTIGUOUS A constant used by the consumer in its call to | |
| FORMAT | back to summary |
|---|---|
| public static final int FORMAT A constant used by the consumer in its call to | |
| FULL | back to summary |
|---|---|
| public static final int FULL Equivalent to | |
| FULL_RO | back to summary |
|---|---|
| public static final int FULL_RO Equivalent to | |
| INDIRECT | back to summary |
|---|---|
| public static final int INDIRECT A constant used by the consumer in its call to | |
| IS_C_CONTIGUOUS | back to summary |
|---|---|
| public static final int IS_C_CONTIGUOUS A constant used by the exporter in processing | |
| IS_F_CONTIGUOUS | back to summary |
|---|---|
| public static final int IS_F_CONTIGUOUS A constant used by the exporter in processing | |
| MAX_NDIM | back to summary |
|---|---|
| public static final int MAX_NDIM The maximum allowed number of dimensions (CPython restriction). | |
| NAVIGATION | back to summary |
|---|---|
| public static final int NAVIGATION Field mask, used as in
The
Flags outside the | |
| ND | back to summary |
|---|---|
| public static final int ND A constant used by the consumer in its call to | |
| RECORDS | back to summary |
|---|---|
| public static final int RECORDS Equivalent to | |
| RECORDS_RO | back to summary |
|---|---|
| public static final int RECORDS_RO Equivalent to | |
| SIMPLE | back to summary |
|---|---|
| public static final int SIMPLE A constant used by the consumer in its call to | |
| STRIDED | back to summary |
|---|---|
| public static final int STRIDED Equivalent to | |
| STRIDED_RO | back to summary |
|---|---|
| public static final int STRIDED_RO Equivalent to | |
| STRIDES | back to summary |
|---|---|
| public static final int STRIDES A constant used by the consumer in its call to | |
| WRITABLE | back to summary |
|---|---|
| public static final int WRITABLE A constant used by the consumer in its call to | |
| getItemsize | back to summary |
|---|---|
| public int getItemsize() The number of bytes stored in each indexable item.
| |
| getLen | back to summary |
|---|---|
| public int getLen() The total number of bytes represented by the view, which will be the product of the elements
of the
| |
| getNdim | back to summary |
|---|---|
| public int getNdim() The number of dimensions to the buffer. This number is the length of the
| |
| getShape | back to summary |
|---|---|
| public int[] getShape() An array reporting the size of the buffer, considered as a multidimensional array, in each
dimension and (by its length) giving the number of dimensions. The size of the buffer is its
size in "items". An item is the amount of buffer content addressed by one index or set of
indices. In the simplest case an item is a single unit (byte), and there is one dimension. In
complex cases, the array is multi-dimensional, and the item at each location is multi-unit
(multi-byte). The consumer must not modify this array. A valid
| |
| getStrides | back to summary |
|---|---|
| public int[] getStrides() The
| |
| getSuboffsets | back to summary |
|---|---|
| public int[] getSuboffsets() The
| |
| isContiguous | back to summary |
|---|---|
| public boolean isContiguous(char order) Enquire whether the array is represented contiguously in the backing storage, according to C or Fortran ordering. A one-dimensional contiguous array is both.
| |
| isReadonly | back to summary |
|---|---|
| public boolean isReadonly() Determine whether the consumer is entitled to write to the exported storage.
| |