Download the PHP package nelexa/buffer without Composer

On this page you can find all versions of the php package nelexa/buffer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package buffer

nelexa/buffer -> Read And Write Binary Data

Packagist Version Packagist Build Status License

This is classes defines methods for reading and writing values of all primitive types. Primitive values are translated to (or from) sequences of bytes according to the buffer's current byte order, which may be retrieved and modified via the order methods. The initial order of a byte buffer is always Buffer::BIG_ENDIAN.

Requirements

Installation

Documentation

Class \Nelexa\Buffer is abstract and base methods for all other buffers.

Initialize buffer as string.

Initialize buffer as file.

Initialize buffer as memory resource (php://memory).

Initialize buffer as stream resource.

Set read only buffer

Checking the possibility of recording in the buffer

Modifies this buffer's byte order, either Buffer::BIG_ENDIAN or Buffer::LITTLE_ENDIAN

Get buffer's byte order

Get buffer size.

Set buffer position.

Get buffer position.

Skip bytes.

Skip primitive type size.

Rewinds this buffer. The position is set to zero.

Flips this buffer. The limit is set to the current position and then the position is set to zero.

Returns the number of elements between the current position and the limit.

Tells whether there are any elements between the current position and the limit. True if, and only if, there is at least one element remaining in this buffer

Close buffer and release resources

Read buffer

Read the entire contents of the buffer into a string without changing the position of the buffer.

Reads the string at this buffer's current position, and then increments the position.

Read literal types
Method Type Values
$buffer->getBoolean boolean true or false
$buffer->getByte() byte -128 ... 127
$buffer->getUnsignedByte() unsigned byte (ubyte) 0 ... 255
$buffer->getShort() short (2 bytes) -32768 ... 32767
$buffer->getUnsignedShort() unsigned short (ushort) 0 ... 65535
$buffer->getInt() int (4 bytes) -2147483648 ... 2147483647
$buffer->getUnsignedInt() unsigned int (uint) 0 ... 4294967296
$buffer->getLong() long (8 bytes) -9223372036854775808 ... 9223372036854775807
$buffer->getFloat() float (4 bytes) single-precision 32-bit IEEE 754 floating point number
$buffer->getDouble() double (5 bytes) double-precision 64-bit IEEE 754 floating point number
$buffer->getArrayBytes($length) byte[] array
$buffer->getString($length) string (length bytes) string
$buffer->getUTF() string string
$buffer->getUTF16($length) string (length * 2) string

Write to buffer

Insert bytes to buffer

Insert string (byte[]) or Buffer to buffer.

Insert primitive types

Insert boolean value false or true. Change size and position by +1.

Insert byte (-128 >= byte <= 127). Change size and position by +1.

Insert short value (-32768 >= short <= 32767). Change size and position by +2.

Insert integer value (-2147483648 >= int <= 2147483647). Change size and position by +4.

Insert long value (-9223372036854775808 >= long <= 9223372036854775807). Change position +8.

Insert float value (single-precision 32-bit IEEE 754 floating point number). Change position +4.

Insert double value (double-precision 64-bit IEEE 754 floating point number). Change position +8.

Insert array bytes. Change size and position by +(size array).

Insert string value. Change size and position by +(length string).

Insert UTF-8 string with encoding first two bytes as length string. Change size and position by +(2 + length string).

Analog java java.io.DataOutputStream#writeUTF(String str)

Insert string with UTF-16 encoding. Change size and position by +(2 * length string).

Put bytes to buffer

Put string (byte[]) or Buffer to buffer and overwrite old value.

Put primitive types

Put boolean value false or true. Change position by +1.

Put byte (-128 >= byte <= 127). Change position by +1.

Put short value (-32768 >= short <= 32767). Change position by +2.

Put integer value (-2147483648 >= int <= 2147483647). Change position by +4.

Put long value (-9223372036854775808 >= long <= 9223372036854775807). Change position by +8.

Put float value (single-precision 32-bit IEEE 754 floating point number). Change position +4.

Put double value (double-precision 64-bit IEEE 754 floating point number). Change position +8.

Put array bytes. Change position by +(size array).

Insert string value. Change position by +(length string).

Put UTF-8 string with encoding first two bytes as length string. Change position by +(2 + length string).

Analog java java.io.DataOutputStream#writeUTF(String str)

Put string with UTF-16 encoding. Change position by +(2 * length string).

Replace bytes by buffer

Replace following a certain number of bytes by string or another Buffer.

Replace by primitive types

Replace by boolean value false or true. Change size by (-$length + 1) and position +1.

Replace by byte (-128 >= byte <= 127). Change size by (-$length + 1) and position +1.

Replace by short value (-32768 >= short <= 32767). Change size by (-$length + 2) and position +2.

Replace by integer value (-2147483648 >= int <= 2147483647). Change size by (-$length + 4) and position +4.

Replace by long value (-9223372036854775808 >= long <= 9223372036854775807). Change size by (-$length + 8) and position +8.

Replace by float value (single-precision 32-bit IEEE 754 floating point number). Change size by (-$length + 4) and position +4.

Replace by double value (double-precision 64-bit IEEE 754 floating point number). Change size by (-$length + 8) and position +8.

Replace by array bytes. Change size by (-$length + size array) and position +(size array).

Replace by string value. Change size by (-$length + length string) and position +(length string).

Replace by UTF-8 string with encoding first two bytes as length string. Change size by (-$length + 2 + length string) and position +(2 + length string).

Analog java java.io.DataOutputStream#writeUTF(String str)

Replace by string with UTF-16 encoding. Change size by (-$length + 2 length string) and position +(2 length string).

Remove bytes by buffer

Remove a certain number of bytes. Change size by -$length.

Remove all bytes. Truncate buffer.

Fluent interface


All versions of buffer with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package nelexa/buffer contains the following files

Loading the files please wait ....