Class BaseBuffer
- All Implemented Interfaces:
AutoCloseable,BufferProtocol,PyBUF,PyBuffer
- Direct Known Subclasses:
Base1DBuffer
This class leaves undefined the storage mechanism for the bytes (typically byte[] or
java.nio.ByteBuffer), while remaining definite that it is an indexable sequence of
bytes. A concrete class that extends this one must provide elementary accessors
byteAtImpl(int), storeAtImpl(byte, int) that abstract this storage, a factory
getNIOByteBufferImpl() for ByteBuffers that wrap the storage, and a factory
for slices PyBuffer.getBufferSlice(int, int, int, int).
The sub-class constructor must specify the feature flags (see
BaseBuffer(int, int, int[], int[])), set index0, shape and
strides, and finally check the client capabilities with checkRequestFlags(int).
A sub-class intended to represent slices of an exporter that counts its exports, as part of a
locking protocol like bytearray's, must override getRoot() so that a call
to release() on a view of slice, propagates to the buffer view that provided the slice.
Access methods provided here necessarily work with the abstracted byteAtImpl(int),
storeAtImpl(byte, int) interface, but subclasses are able to override them with more
efficient versions that employ knowledge of the particular storage type used.
This base implementation is writable only if PyBUF.WRITABLE is in the feature flags
passed to the constructor. Otherwise, all methods for write access raise a TypeError
and isReadonly() returns true. However, a client intending to write should
have presented PyBUF.WRITABLE in its client request flags when getting the buffer, and
been prevented by a BufferError exception at that point.
At the time of writing, only one-dimensional buffers of item size one are used in the Jython core.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.python.core.PyBuffer
PyBuffer.Pointer -
Field Summary
Fields inherited from interface org.python.core.PyBUF
ANY_CONTIGUOUS, AS_ARRAY, C_CONTIGUOUS, CONTIG, CONTIG_RO, CONTIGUITY, F_CONTIGUOUS, FORMAT, FULL, FULL_RO, INDIRECT, IS_C_CONTIGUOUS, IS_F_CONTIGUOUS, MAX_NDIM, NAVIGATION, ND, RECORDS, RECORDS_RO, SIMPLE, STRIDED, STRIDED_RO, STRIDES, WRITABLE -
Method Summary
Modifier and TypeMethodDescriptionbytebyteAt(int index) Return the byte indexed from a one-dimensional buffer with item size one.bytebyteAt(int... indices) Return the byte indexed from an N-dimensional buffer with item size one.intbyteIndex(int index) Convert an item index (for a one-dimensional buffer) to an absolute byte index in the storage shared by the exporter.intbyteIndex(int... indices) Convert a multi-dimensional item index to an absolute byte index in the storage shared by the exporter.voidclose()An alias forPyBuffer.release()to satisfyAutoCloseable.voidcopyFrom(byte[] src, int srcPos, int destIndex, int count) Copy from a slice of a (Java) byte array into the buffer starting at a given destination item-index.voidCopy the whole of anotherPyBufferinto this buffer.voidcopyTo(byte[] dest, int destPos) Copy the contents of the buffer to the destination byte array.voidcopyTo(int srcIndex, byte[] dest, int destPos, int count) Copy a simple slice of the buffer-view to the destination byte array, defined by a starting item-index in the source buffer and thecountof items to copy.getBuf()Return a structure describing the slice of a byte array that holds the data being exported to the consumer.getBuffer(int flags) Method by which the consumer requests the buffer from the exporter.getBufferAgain(int flags) Allow an exporter to re-use this object again even if it has been "finally" released.getBufferSlice(int flags, int start, int count) Equivalent toPyBuffer.getBufferSlice(int, int, int, int)with stride 1.A format string in the language of Python structs describing how the bytes of each item should be interpreted.intThe number of bytes stored in each indexable item.intgetLen()The total number of bytes represented by the view, which will be the product of the elements of theshapearray, and the item size in bytes.intgetNdim()The number of dimensions to the buffer.Obtain aByteBuffergiving access to the bytes that hold the data being exported by the original object.final BufferProtocolgetObj()Return the underlying exporting object (ornullif no object implementing theBufferProtocolis in that role).getPointer(int index) Return a structure describing the position in a byte array of a single item from the data being exported to the consumer.getPointer(int... indices) 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.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.int[]Thestridesarray gives the distance in the storage array between adjacent items (in each dimension).int[]Thesuboffsetsarray is a further part of the support for interpreting the buffer as an n-dimensional array of items, where the array potentially uses indirect addressing (like a real Java array of arrays, in fact).booleanhasArray()Report whether the exporter is able to offer direct access to the exported storage as a Java byte array (through the API that involves classPyBuffer.Pointer), or only supports the abstract API.intintAt(int index) Return the unsigned byte value indexed from a one-dimensional buffer with item size one.intintAt(int... indices) Return the unsigned byte value indexed from an N-dimensional buffer with item size one.booleanisContiguous(char order) Enquire whether the array is represented contiguously in the backing storage, according to C or Fortran ordering.booleanDetermine whether the consumer is entitled to write to the exported storage.booleanTrue only if the buffer has been released with (the required number of calls to)PyBuffer.release()or some equivalent operation.voidrelease()A buffer is (usually) a view onto to the internal state of an exporting object, and that object may have to restrict its behaviour while the buffer exists.voidstoreAt(byte value, int index) Store the given byte at the indexed location in of a one-dimensional buffer with item size one.voidstoreAt(byte value, int... indices) Store the given byte at the indexed location in of an N-dimensional buffer with item size one.toString()The toString() method of a buffer reproduces the values in the buffer (as unsigned integers) as the character codes of aString.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.python.core.PyBuffer
getBufferSlice
-
Method Details
-
isReadonly
public boolean isReadonly()Description copied from interface:PyBUFDetermine whether the consumer is entitled to write to the exported storage.- Specified by:
isReadonlyin interfacePyBUF- Returns:
- true if writing is not allowed, false if it is.
-
getNdim
public int getNdim()Description copied from interface:PyBUFThe number of dimensions to the buffer. This number is the length of theshapearray. The actual storage may be a linear array, but this is the number of dimensions in the interpretation that the exporting object gives the data. -
getShape
public int[] getShape()Description copied from interface:PyBUFAn 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 validshapearray is always returned (difference from CPython). -
getLen
public int getLen()Description copied from interface:PyBUFThe total number of bytes represented by the view, which will be the product of the elements of theshapearray, and the item size in bytes. -
getObj
Description copied from interface:PyBufferReturn the underlying exporting object (ornullif no object implementing theBufferProtocolis in that role). This will often be aPyObject. -
byteAt
Return the byte indexed from a one-dimensional buffer with item size one. This is part of the fully-encapsulated API: the buffer implementation exported takes care of navigating the structure of the buffer. Results are undefined where the number of dimensions is not one or ifitemsize>1.The
BaseBufferimplementation delegates tobyteAtImpl(int)viabyteAtImpl(byteIndex(index)).- Specified by:
byteAtin interfacePyBuffer- Parameters:
index- to retrieve from- Returns:
- the item at index, which is a byte
- Throws:
IndexOutOfBoundsException
-
intAt
Return the unsigned byte value indexed from a one-dimensional buffer with item size one. This is part of the fully-encapsulated API: the exporter takes care of navigating the structure of the buffer. Results are undefined where the number of dimensions is not one or ifitemsize>1.The
BaseBufferimplementation delegates tobyteAtImpl(int)viabyteAtImpl(byteIndex(index)), cast unsigned to anint.- Specified by:
intAtin interfacePyBuffer- Parameters:
index- to retrieve from- Returns:
- the item at index, treated as an unsigned byte,
=0xff & byteAt(index) - Throws:
IndexOutOfBoundsException
-
storeAt
Store the given byte at the indexed location in of a one-dimensional buffer with item size one. This is part of the fully-encapsulated API: the buffer implementation exported takes care of navigating the structure of the buffer. Results are undefined where the number of dimensions is not one or ifitemsize>1.The
BaseBufferimplementation delegates tostoreAtImpl(byte, int)viastoreAtImpl(value, byteIndex(index)).- Specified by:
storeAtin interfacePyBuffer- Parameters:
value- to storeindex- to location- Throws:
IndexOutOfBoundsExceptionPyException
-
byteAt
Return the byte indexed from an N-dimensional buffer with item size one. This is part of the fully-encapsulated API: the buffer implementation exported takes care of navigating the structure of the buffer. The indices must be correct in number and range for the array shape. Results are undefined whereitemsize>1.The
BaseBufferimplementation delegates tobyteAtImpl(int)viabyteAtImpl(byteIndex(indices)).- Specified by:
byteAtin interfacePyBuffer- Parameters:
indices- specifying location to retrieve from- Returns:
- the item at location, which is a byte
- Throws:
IndexOutOfBoundsException
-
intAt
Return the unsigned byte value indexed from an N-dimensional buffer with item size one. This is part of the fully-encapsulated API: the buffer implementation exported takes care of navigating the structure of the buffer. The indices must be correct in number and range for the array shape. Results are undefined whereitemsize>1.The
BaseBufferimplementation delegates tobyteAtImpl(int)viabyteAtImpl(byteIndex(indices)), cast unsigned to anint.- Specified by:
intAtin interfacePyBuffer- Parameters:
indices- specifying location to retrieve from- Returns:
- the item at location, treated as an unsigned byte,
=0xff & byteAt(index) - Throws:
IndexOutOfBoundsException
-
storeAt
Store the given byte at the indexed location in of an N-dimensional buffer with item size one. This is part of the fully-encapsulated API: the exporter takes care of navigating the structure of the buffer. The indices must be correct in number and range for the array shape. Results are undefined whereitemsize>1.The
BaseBufferimplementation delegates tostoreAtImpl(byte, int)viastoreAtImpl(value, byteIndex(indices)).- Specified by:
storeAtin interfacePyBuffer- Parameters:
value- to storeindices- specifying location to store at- Throws:
IndexOutOfBoundsExceptionPyException
-
byteIndex
Description copied from interface:PyBufferConvert an item index (for a one-dimensional buffer) to an absolute byte index in the storage shared by the exporter. The storage exported as aPyBufferis a linearly-indexed sequence of bytes, although it may not actually be a heap-allocated Javabyte[]object. The purpose of this method is to allow the exporter to define the relationship between the item index (as used inPyBuffer.byteAt(int)) and the byte-index (as used with theByteBufferreturned byPyBuffer.getNIOByteBuffer()). SeePyBuffer.byteIndex(int[])for discussion of the multi-dimensional case.- Specified by:
byteIndexin interfacePyBuffer- Parameters:
index- item-index from consumer- Returns:
- corresponding byte-index in actual storage
- Throws:
IndexOutOfBoundsException
-
byteIndex
Description copied from interface:PyBufferConvert a multi-dimensional item index to an absolute byte index in the storage shared by the exporter. The storage exported as aPyBufferis a linearly-indexed sequence of bytes, although it may not actually be a heap-allocated Javabyte[]object. The purpose of this method is to allow the exporter to define the relationship between the item index (as used inPyBuffer.byteAt(int...)and the byte-index (as used with theByteBufferreturned byPyBuffer.getNIOByteBuffer()).- Specified by:
byteIndexin interfacePyBuffer- Parameters:
indices- n-dimensional item-index from consumer- Returns:
- corresponding byte-index in actual storage
- Throws:
IndexOutOfBoundsException
-
copyTo
Copy the contents of the buffer to the destination byte array. The number of bytes will be that returned byPyBUF.getLen(), and the order is the storage order in the exporter. (Note: Correct ordering for multidimensional arrays, including those with indirection needs further study.)The default implementation in
BaseBufferdeals with the general one-dimensional case of arbitrary item size and stride.- Specified by:
copyToin interfacePyBuffer- Parameters:
dest- destination byte arraydestPos- byte-index in the destination array of the byte [0]- Throws:
IndexOutOfBoundsException- if the destination cannot hold it
-
copyTo
public void copyTo(int srcIndex, byte[] dest, int destPos, int count) throws IndexOutOfBoundsException, PyException Copy a simple slice of the buffer-view to the destination byte array, defined by a starting item-index in the source buffer and thecountof items to copy. This may validly be done only for a one-dimensional buffer, as the meaning of the starting item-index is otherwise not defined.count*itemsizebytes will be occupied in the destination.The default implementation in
BaseBufferdeals with the general one-dimensional case of arbitrary item size and stride, but is unable to optimise access to sequential bytes.- Specified by:
copyToin interfacePyBuffer- Parameters:
srcIndex- starting item-index in the source bufferdest- destination byte arraydestPos- byte-index in the destination array of the source item [0,...]count- number of items to copy- Throws:
IndexOutOfBoundsException- if access out of bounds in source or destinationPyException
-
copyFrom
public void copyFrom(byte[] src, int srcPos, int destIndex, int count) throws IndexOutOfBoundsException, PyException Copy from a slice of a (Java) byte array into the buffer starting at a given destination item-index. This may validly be done only for a one-dimensional buffer, as the meaning of the destination index is not otherwise defined.count*itemsizebytes will be read from the source.The default implementation in
BaseBufferdeals with the general one-dimensional case of arbitrary item size and stride, but is unable to optimise access to sequential bytes.- Specified by:
copyFromin interfacePyBuffer- Parameters:
src- source byte arraysrcPos- location in source of first byte to copydestIndex- starting item-index in the destination (i.e.this)count- number of items to copy in- Throws:
IndexOutOfBoundsException- if access out of bounds in source or destinationPyException-TypeErrorif read-only buffer
-
copyFrom
Copy the whole of anotherPyBufferinto this buffer. This may validly be done only for buffers that are consistent in their dimensions. When it is necessary to copy partial buffers, this may be achieved using a buffer slice on the source or destination.The default implementation in
BaseBufferdeals with the general one-dimensional case of arbitrary item size and stride, but is unable to optimise access to sequential bytes.- Specified by:
copyFromin interfacePyBuffer- Parameters:
src- source buffer- Throws:
IndexOutOfBoundsException- if access out of bounds in source or destinationPyException-TypeErrorif read-only buffer
-
getBuffer
Description copied from interface:PyBufferMethod by which the consumer requests the buffer from the exporter. The consumer provides information on its ability to understand buffer navigation. Each consumer requesting a buffer in this way, when it has finished using it, should make a corresponding call toPyBuffer.release()on the buffer it obtained, orPyBuffer.close()using try-with-resources, since some objects alter their behaviour while buffers are exported.When a
PyBufferis the target, the same checks are carried out on the consumer flags, and a return will normally be a reference to that buffer. A JythonPyBufferkeeps count of these re-exports in order to match them with the number of calls toPyBuffer.release(). When the last matchingrelease()arrives it is considered "final", and release actions may then take place on the exporting object. After the final release of a buffer, a call togetBuffershould raise an exception.- Specified by:
getBufferin interfaceBufferProtocol- Specified by:
getBufferin interfacePyBuffer- Parameters:
flags- specifying features demanded and the navigational capabilities of the consumer- Returns:
- exported buffer
-
getBufferAgain
Allow an exporter to re-use this object again even if it has been "finally" released. Many sub-classes ofBaseBytescan be re-used even after a final release by consumers, simply by incrementing theexportscount again: the navigation arrays and the buffer view of the exporter's state all remain valid. We do not let consumers do this through thePyBufferinterface: from their perspective, callingPyBuffer.release()should mean the end of their access, although we can't stop them holding a reference to the PyBuffer. Only the exporting object, which handles the implementation type is trusted to know when re-use is safe.An exporter will use this method as part of its implementation of
BufferProtocol.getBuffer(int). On return from that, the buffer and the exporting object must then be in effectively the same state as if the buffer had just been constructed by that method. Exporters that destroy related resources on final release of their buffer (by overridingreleaseAction()), or permit themselves structural change invalidating the buffer, must either reconstruct the missing resources or avoidgetBufferAgain. -
release
public void release()A buffer is (usually) a view onto to the internal state of an exporting object, and that object may have to restrict its behaviour while the buffer exists. The consumer must therefore say when it has finished with the buffer if the exporting object is to be released from this constraint. Each consumer that obtains a reference to a buffer by means of a call toBufferProtocol.getBuffer(int)orPyBuffer.getBuffer(int)should make a matching call toPyBuffer.release(). The consumer may be sharing thePyBufferwith other consumers and the buffer uses the pairing ofgetBufferandreleaseto manage the lock on behalf of the exporter. It is an error to make more than one call toreleasefor a single call togetBuffer.When the final matching release occurs (that is the number of
releasecalls equals the number ofgetBuffercalls), the implementation here callsreleaseAction(), which the implementer of a specific buffer type should override if it needs specific actions to take place.Note that, when this is a sliced view obtained from another
PyBufferthe implementation inBaseBufferautomatically sends onerelease()Sub-classes should not propagate the release themselves when overridingreleaseAction(). -
close
public void close()Description copied from interface:PyBufferAn alias forPyBuffer.release()to satisfyAutoCloseable.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfacePyBuffer
-
isReleased
public boolean isReleased()Description copied from interface:PyBufferTrue only if the buffer has been released with (the required number of calls to)PyBuffer.release()or some equivalent operation. The consumer may be sharing the reference with other consumers and the buffer only achieves the released state when all consumers who calledgetBufferhave calledrelease.- Specified by:
isReleasedin interfacePyBuffer
-
getBufferSlice
Description copied from interface:PyBufferEquivalent toPyBuffer.getBufferSlice(int, int, int, int)with stride 1.- Specified by:
getBufferSlicein interfacePyBuffer- Parameters:
flags- specifying features demanded and the navigational capabilities of the consumerstart- index in the current buffercount- number of items in the required slice- Returns:
- a buffer representing the slice
-
getNIOByteBuffer
Description copied from interface:PyBufferObtain aByteBuffergiving access to the bytes that hold the data being exported by the original object. The position of the buffer is at the first byte of the item with zero index (quite possibly not the lowest valid byte-index), the limit of the buffer is beyond the largest valid byte index, and the mark is undefined.For a one-dimensional contiguous buffer, the limit is one byte beyond the last item, so that consecutive reads from the
ByteBufferreturn the data in order. Assuming the following client code whereobjhas typeBufferProtocol:PyBuffer a = obj.getBuffer(PyBUF.SIMPLE); int itemsize = a.getItemsize(); ByteBuffer bb = a.getNIOBuffer();
the item with indexkis inbbat positionsbb.pos()+k*itemsizetobb.pos()+(k+1)*itemsize - 1inclusive. And ifitemsize==1, the item is simply the byte at positionbb.pos()+k.If the buffer is multidimensional or non-contiguous (strided), the buffer position is still the (first byte of) the item at index
[0]or[0,...,0]. However, it is necessary to navigatebbusing theshape,stridesand maybesuboffsetsprovided by the API.- Specified by:
getNIOByteBufferin interfacePyBuffer- Returns:
- a
ByteBufferonto the exported data contents.
-
hasArray
public boolean hasArray()Description copied from interface:PyBufferReport whether the exporter is able to offer direct access to the exported storage as a Java byte array (through the API that involves classPyBuffer.Pointer), or only supports the abstract API. See alsoPyBUF.AS_ARRAY. -
getBuf
Description copied from interface:PyBufferReturn 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 whereobjhas typeBufferProtocol:PyBuffer a = obj.getBuffer(PyBUF.SIMPLE); int itemsize = a.getItemsize(); PyBuffer.Pointer b = a.getBuf();
the item with indexkis in the arrayb.storageat index[b.offset + k*itemsize]to[b.offset + (k+1)*itemsize - 1]inclusive. And ifitemsize==1, the item is simply the byteb.storage[b.offset + k]If the buffer is multidimensional or non-contiguous,
storage[offset]is still the (first byte of) the item at index [0] or [0,...,0]. However, it is necessary to navigateb.storageusing theshape,stridesand maybesuboffsetsprovided by the API. -
getPointer
Description copied from interface:PyBufferReturn 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 whereobjhas typeBufferProtocol:int k = ... ; PyBuffer a = obj.getBuffer(PyBUF.FULL); int itemsize = a.getItemsize(); PyBuffer.Pointer b = a.getPointer(k);
the item with indexkis in the arrayb.storageat index[b.offset]to[b.offset + itemsize - 1]inclusive. And ifitemsize==1, the item is simply the byteb.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
b.storagewithout respecting these boundaries.- Specified by:
getPointerin interfacePyBuffer- Parameters:
index- in the buffer to position the pointer- Returns:
- structure defining the byte[] slice that is the shared data
- Throws:
IndexOutOfBoundsException
-
getPointer
Description copied from interface:PyBufferReturn 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 whereobjhas typeBufferProtocol: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 arrayb.storageat index[b.offset]to[b.offset + itemsize - 1]inclusive. And ifitemsize==1, the item is simply the byteb.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
b.storagewithout respecting these boundaries. If the buffer is non-contiguous, the above description is still valid (since a multi-byte item must itself be contiguously stored), but in any additional navigation ofb.storage[]to other items, the client must use the shape, strides and sub-offsets provided by the API. Normally one startsb = a.getBuf()in order to establish the offset of index [0,...,0].- Specified by:
getPointerin interfacePyBuffer- Parameters:
indices- multidimensional index at which to position the pointer- Returns:
- structure defining the byte[] slice that is the shared data
- Throws:
IndexOutOfBoundsException
-
getStrides
public int[] getStrides()Description copied from interface:PyBUFThestridesarray gives the distance in the storage array between adjacent items (in each dimension). In the rawest parts of the buffer API, the consumer of the buffer is able to navigate the exported storage. The "strides" array is part of the support for interpreting the buffer as an n-dimensional array of items. It provides the coefficients of the "addressing polynomial". (More on this in the CPython documentation.) The consumer must not modify this array. A validstridesarray is always returned (difference from CPython).- Specified by:
getStridesin interfacePyBUF- Returns:
- the distance in the storage array between adjacent items (in each dimension)
-
getSuboffsets
public int[] getSuboffsets()Description copied from interface:PyBUFThesuboffsetsarray is a further part of the support for interpreting the buffer as an n-dimensional array of items, where the array potentially uses indirect addressing (like a real Java array of arrays, in fact). This is only applicable when there is more than 1 dimension, and it works in conjunction with thestridesarray. (More on this in the CPython documentation.) When used,suboffsets[k]is an integer index, not a byte offset as in CPython. The consumer must not modify this array. When not needed for navigationnullis returned (as in CPython).- Specified by:
getSuboffsetsin interfacePyBUF- Returns:
- suboffsets array or
nullif not necessary for navigation
-
isContiguous
public boolean isContiguous(char order) Description copied from interface:PyBUFEnquire whether the array is represented contiguously in the backing storage, according to C or Fortran ordering. A one-dimensional contiguous array is both.- Specified by:
isContiguousin interfacePyBUF- Parameters:
order- 'C', 'F' or 'A', as the storage order is C, Fortran or either.- Returns:
- true iff the array is stored contiguously in the order specified
-
getFormat
Description copied from interface:PyBufferA format string in the language of Python structs describing how the bytes of each item should be interpreted. Irrespective of thePyBUF.FORMATbit in the consumer's call togetBuffer, a validformatstring is always returned (difference from CPython).Jython only implements "B" so far, and it is debatable whether anything fancier than "<n>B" can be supported in Java.
-
getItemsize
public int getItemsize()Description copied from interface:PyBUFThe number of bytes stored in each indexable item.- Specified by:
getItemsizein interfacePyBUF- Returns:
- the number of bytes comprising each item.
-
toString
The toString() method of a buffer reproduces the values in the buffer (as unsigned integers) as the character codes of aString.
-