java.nio.ByteBuffer or
org.python.core.PyBuffer.Pointer result), and therefore this class must create a byte array from the
String for them. However, it defers creation of a byte array until that part of the API is
actually used. Where possible, this class overrides those methods in SimpleBuffer that would
otherwise access the byte array attribute to use the String instead.
| Modifier and Type | Class and Description |
|---|---|
| pack-priv static class | SimpleStringBuffer.
A |
| Modifier and Type | Field and Description |
|---|---|
| private String | bufString
The string backing this PyBuffer. |
| Access | Constructor and Description |
|---|---|
| public | SimpleStringBuffer(int
consumer requirements flags, BufferProtocol exporting object (or obj, String null)storing the implementation of the object bufString)Provide an instance of SimpleStringBuffer meeting the consumer's expectations as expressed in the flags argument. |
| Modifier and Type | Method and Description |
|---|---|
| public final byte | byteAtImpl(int
byte-index of location to retrieve index)Overrides org. Retrieve the byte at the given index in the underlying storage treated as a flat sequence of bytes. |
| public final int | byteIndex(int
item-index from consumer index)Overrides org. Implements org. Convert an item index (for a one-dimensional buffer) to an absolute byte index in the storage shared by the exporter. |
| public void | copyTo(int
starting item-index in the source buffer srcIndex, byte[] destination byte array dest, int byte-index in the destination array of the source item [0,...] destPos, int number of items to copy count)Overrides org. Implements org. Copy a simple slice of the buffer-view to the destination byte array, defined by a starting
item-index in the source buffer and the |
| private void | ensureHaveBytes()
This method creates an actual byte array from the underlying String if none yet exists. |
| public PyBuffer. | getBuf()
Overrides org. Implements org.
References Deprecated
PyBuffer.Pointer is deprecated or references (maybe indirectly) at least one deprecated element.
Return a structure describing the slice of a byte array that holds the data being exported to the consumer. |
| public PyBuffer | getBufferSlice(int
specifying features demanded and the navigational capabilities of the consumer flags, int index in the current buffer start, int number of items in the required slice count)Overrides org. Implements org. Equivalent to |
| public PyBuffer | getBufferSlice(int
specifying features demanded and the navigational capabilities of the consumer flags, int index in the current buffer start, int number of items in the required slice count, int index-distance in the current buffer between consecutive items in the slice stride)Overrides org. Implements org. Get a |
| public int | getLen()
Overrides org. Implements org. The total number of bytes represented by the view, which will be the product of the elements
of the |
| protected ByteBuffer | getNIOByteBufferImpl()
Overrides org. Create a new |
| public PyBuffer. | getPointer(int
in the buffer to position the pointer index)Overrides org. Implements org.
References Deprecated
PyBuffer.Pointer is deprecated or references (maybe indirectly) at least one deprecated element.
Return a structure describing the position in a byte array of a single item from the data being exported to the consumer. |
| public PyBuffer. | getPointer(int...
multidimensional index at which to position the pointer indices)Overrides org. Implements org.
References Deprecated
PyBuffer.Pointer is deprecated or references (maybe indirectly) at least one deprecated element.
Return a structure describing the position in a byte array of a single item from the data being exported to the consumer, in the case that array may be multi-dimensional. |
| public String | toString()
Overrides org. Implements org. The |
| bufString | back to summary |
|---|---|
| private String bufString The string backing this PyBuffer. A substitute for | |
| SimpleStringBuffer | back to summary |
|---|---|
| public SimpleStringBuffer(int flags, BufferProtocol obj, String bufString) Provide an instance of SimpleStringBuffer meeting the consumer's expectations as expressed in the flags argument.
| |
| byteAtImpl | back to summary |
|---|---|
| public final byte byteAtImpl(int index) Overrides org. Doc from org. Retrieve the byte at the given index in the underlying storage treated as a flat sequence of
bytes. This byte-index will have been computed from the item index (which may have been
multi-dimensional), taking into account
This method uses
| |
| byteIndex | back to summary |
|---|---|
| public final int byteIndex(int index) Overrides org. Implements org. Doc from org. Convert an item index (for a one-dimensional buffer) to an absolute byte index in the storage
shared by the exporter. The storage exported as a
In
In
| |
| copyTo | back to summary |
|---|---|
| public void copyTo(int srcIndex, byte[] dest, int destPos, int count) throws IndexOutOfBoundsException Overrides org. Implements org. Doc from org. Copy a simple slice of the buffer-view to the destination byte array, defined by a starting
item-index in the source buffer and the
The default implementation in
The implementation in
This method uses
| |
| ensureHaveBytes | back to summary |
|---|---|
| private void ensureHaveBytes() This method creates an actual byte array from the underlying String if none yet exists. | |
| getBuf | back to summary |
|---|---|
| public PyBuffer. Overrides org. Implements org. Doc from org. References Deprecated
See corresponding docs for further information. Return a structure describing the slice of a byte array that holds the data being exported to
the consumer. For a one-dimensional contiguous buffer, assuming the following client code
where PyBuffer a = obj.getBuffer(PyBUF.SIMPLE); int itemsize = a.getItemsize(); PyBuffer.Pointer b = a.getBuf();the item with index k is in the array b.storage at index
[b.offset + k*itemsize] to [b.offset + (k+1)*itemsize - 1]
inclusive. And if itemsize==1, the item is simply the byte
b.storage[b.offset + k]
If the buffer is multidimensional or non-contiguous,
This method creates an actual byte array from the underlying String if none yet exists.
| |
| getBufferSlice | back to summary |
|---|---|
| public PyBuffer getBufferSlice(int flags, int start, int count) Overrides org. Implements org. Doc from org. Equivalent to
The
a buffer representing the slice | |
| getBufferSlice | back to summary |
|---|---|
| public PyBuffer getBufferSlice(int flags, int start, int count, int stride) Overrides org. Implements org. Doc from org. Get a
Suppose that x(i) denotes the ith element of the current buffer, that is, the
byte retrieved by
In a simple buffer backed by a contiguous byte array, the result is a strided PyBuffer on the
same storage but where the offset is adjusted by s and the stride is as supplied. If
the current buffer is already strided and/or has an item size larger than single bytes, the
new
The
Doc from org. a buffer representing the slice | |
| getLen | back to summary |
|---|---|
| public int getLen() Overrides org. Implements org. Doc from org. The total number of bytes represented by the view, which will be the product of the elements
of the
This method uses
| |
| getNIOByteBufferImpl | back to summary |
|---|---|
| protected ByteBuffer getNIOByteBufferImpl() Overrides org. Doc from org. Create a new
| |
| getPointer | back to summary |
|---|---|
| public PyBuffer. Overrides org. Implements org. Doc from org. References Deprecated
See corresponding docs for further information. Return a structure describing the position in a byte array of a single item from the data
being exported to the consumer. For a one-dimensional contiguous buffer, assuming the
following client code where int k = ... ; PyBuffer a = obj.getBuffer(PyBUF.FULL); int itemsize = a.getItemsize(); PyBuffer.Pointer b = a.getPointer(k);the item with index k is in the array b.storage at index
[b.offset] to [b.offset + itemsize - 1] inclusive. And if
itemsize==1, the item is simply the byte b.storage[b.offset]
Essentially this is a method for computing the offset of a particular index. The client is
free to navigate the underlying buffer This method creates an actual byte array from the underlying String if none yet exists.
| |
| getPointer | back to summary |
|---|---|
| public PyBuffer. Overrides org. Implements org. Doc from org. References Deprecated
See corresponding docs for further information. Return a structure describing the position in a byte array of a single item from the data
being exported to the consumer, in the case that array may be multi-dimensional. For a
3-dimensional contiguous buffer, assuming the following client code where int i, j, k; // ... calculation that assigns i, j, k PyBuffer a = obj.getBuffer(PyBUF.FULL); int itemsize = a.getItemsize(); PyBuffer.Pointer b = a.getPointer(i,j,k);the item with index [i,j,k] is in the array b.storage at index
[b.offset] to [b.offset + itemsize - 1] inclusive. And if
itemsize==1, the item is simply the byte b.storage[b.offset]
Essentially this is a method for computing the offset of a particular index. The client is
free to navigate the underlying buffer This method creates an actual byte array from the underlying String if none yet exists.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides org. Implements org. The
| |
SimpleStringBuffer.SimpleStringView represents a contiguous subsequence of
another SimpleStringBuffer.
| Modifier and Type | Field and Description |
|---|---|
| pack-priv PyBuffer | root
The buffer on which this is a slice view |
| Access | Constructor and Description |
|---|---|
| public | SimpleStringView(PyBuffer
buffer which will be acquired and must be released ultimately root, int the request flags of the consumer that requested the slice flags, String becomes the buffer of bytes for this object bufString)Construct a slice of a SimpleStringBuffer. |
| Modifier and Type | Method and Description |
|---|---|
| protected PyBuffer | getRoot()
Overrides org. Some |
| root | back to summary |
|---|---|
| pack-priv PyBuffer root The buffer on which this is a slice view | |
| SimpleStringView | back to summary |
|---|---|
| public SimpleStringView(PyBuffer root, int flags, String bufString) Construct a slice of a SimpleStringBuffer. | |
| getRoot | back to summary |
|---|---|
| protected PyBuffer getRoot() Overrides org. Doc from org. Some | |