Home | History | Annotate | Download | only in libcutils

Lines Matching defs:Buffer

18  * Byte buffer utilities.
31 * Byte buffer of known size. Keeps track of how much data has been read
32 * into or written out of the buffer.
46 /** Actual # of bytes in the buffer. */
49 /** Amount of memory allocated for this buffer. */
51 } Buffer;
54 * Returns true if all data has been read into the buffer.
56 #define bufferReadComplete(buffer) (buffer->expected == buffer->size)
59 * Returns true if the buffer has been completely written.
61 #define bufferWriteComplete(buffer) (buffer->remaining == 0)
64 * Creates a new buffer with the given initial capacity.
66 Buffer* bufferCreate(size_t initialCapacity);
71 Buffer* bufferWrap(char* data, size_t capacity, size_t size);
76 void bufferFree(Buffer* buffer);
79 * Prepares buffer to read 'expected' number of bytes. Expands capacity if
83 int bufferPrepareForRead(Buffer* buffer, size_t expected);
86 * Reads some data into a buffer. Returns -1 in case of an error and sets
87 * errno (see read()). Returns 0 for EOF. Updates buffer->size and returns
90 * Precondition: buffer->size < buffer->expected
92 ssize_t bufferRead(Buffer* buffer, int fd);
95 * Prepares a buffer to be written out.
97 void bufferPrepareForWrite(Buffer* buffer);
100 * Writes data from buffer to the given fd. Returns -1 and sets errno in case
101 * of an error. Updates buffer->remaining and returns the number of remaining
104 * Precondition: buffer->remaining > 0
106 ssize_t bufferWrite(Buffer* buffer, int fd);