PyByteBuffer
A library to manipulate buffers inspired by Java nio ByteBuffer
Setup
pip3 install PyByteBuffer
Usage
from PyByteBuffer import ByteBuffer
buf = ByteBuffer.allocate(50)
# write byte 0x10 and increment position by 1
buf.put(0x10)
buf.put([0xcc, 0xdd, 0xee])
buf.put('something')
buf.put(bytes([00] * 4))
# endianness
buf.put(123456, 'little')
buf.put(1234561434234234, 'big')
# read 1 byte and increment position by 1
value = buf.get(1)
# read 10 bytes little endian and increment position by 10
value = buf.get(10, 'little')
# other allocations
buf = ByteBuffer.from_hex('deadbeef')
buf = ByteBuffer.wrap(bytes())
About performances
The performance analysis we can do in this library is all around the conversion between int->bytes bytes<-int.
Tested with a cycle of 1/100/500/1000 conversion using python3 builtin api int.to_bytes/from_bytes, struct pack/unpack and a "primitive" solution posted in stackoverflow
Metadata
Release files for PyByteBuffer 1.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| PyByteBuffer-1.0.5.tar.gz | 3.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| PyByteBuffer-1.0.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.1 kB
Release files / PyByteBuffer-1.0.5.tar.gz
| Download URL | PyByteBuffer-1.0.5.tar.gz |
|---|---|
| Size | 3.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5aa1e83c28bf5570d09bae0913937514325a7239e818220506baff8a8c0b51f9
|
|
BLAKE2b-256 checksum How to use checksums |
2207124736940ea5c8526c0e33c241fb25fce5b154e5481b243db50be42f7c3b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.0 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.9.1
|
Release files / PyByteBuffer-1.0.5-py3-none-any.whl
| Download URL | PyByteBuffer-1.0.5-py3-none-any.whl |
|---|---|
| Size | 5.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a6332b48b9a2101bbaeeda086586f214407b7c66bca55210520ee3ac4292d2f0
|
|
BLAKE2b-256 checksum How to use checksums |
53bb95539135ad829e93bb1f20bf1d43de8139b009668c672e0b33d8e91f39aa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.0 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.9.1
|