Inheritance diagram for AbstractReader:
Public Member Functions | |
char[] | toString () |
this (IBuffer buffer) | |
IBuffer | getBuffer () |
IArrayAllocator | getAllocator () |
void | setAllocator (IArrayAllocator memory) |
void | setStringDecoder (IStringDecoder s) |
IReader | push (uint size) |
uint | length () |
void | wait () |
IReader | get (IReadable x) |
IReader | get (inout bool x) |
IReader | get (inout ubyte x) |
IReader | get (inout byte x) |
IReader | get (inout ushort x) |
IReader | get (inout short x) |
IReader | get (inout uint x) |
IReader | get (inout int x) |
IReader | get (inout ulong x) |
IReader | get (inout long x) |
IReader | get (inout float x) |
IReader | get (inout double x) |
IReader | get (inout real x) |
IReader | get (inout char x) |
IReader | get (inout wchar x) |
IReader | get (inout dchar x) |
IReader | get (inout int[] x) |
IReader | get (inout char[] x) |
IReader | get (inout wchar[] x) |
IReader | get (inout dchar[] x) |
Static Public Member Functions | |
this () | |
Protected Attributes | |
IBuffer | buffer |
StringDecoder | string |
NumericDecoder | numeric |
Private Member Functions | |
this (IReader reader) | |
void | reset () |
bool | isReadOnly (void *x) |
void | allocate (void[]*x, BufferConverter decoder) |
Private Attributes | |
IArrayAllocator | memory |
uint | pushed = uint.max |
Static Private Attributes | |
EofException | eof |
IOException | udf |
Readers support both a C++ iostream type syntax, along with a get() syntax. Operations may be chained back-to-back.
All readers support the full set of native data types, plus a selection of array types. The latter can be configured to produce either a copy (.dup) of the buffer content, or a slice. See class SimpleAllocator, BufferAllocator and SliceAllocator for more on this topic.
The code below illustrates basic operation upon a memory buffer:
Buffer buf = new Buffer (256); // map same buffer into both reader and writer IReader r = new Reader(buf); IWriter w = new Writer(buf); int i = 10; long j = 20; double d = 3.14159; char[] c = "fred"; // write data types out w << c << i << j << d; // read them back again r >> c >> i >> j >> d; // reset buf.clear(); // same thing again, but using get() syntax instead w.put(c).put(i).put(j).put(d); r.get(c).get(i).get(j).get(d);
Readers may also be used with any class implementing the IReadable interface. See PickleReader for an example of how this can be put to good use.
Definition at line 96 of file AbstractReader.d.
|
Return the name of this reader Reimplemented in EndianReader, Reader, and TextReader. |
|
Construct a couple of static exception instances. Definition at line 165 of file AbstractReader.d. |
|
Return the buffer associated with this reader Reimplemented in HttpReader, EndianReader, Reader, and TextReader. Definition at line 177 of file AbstractReader.d. |
|
Return the buffer associated with this reader Reimplemented from IReader. Definition at line 190 of file AbstractReader.d. |
|
Return the allocator associated with this reader.See ArrayAllocator for more information. Reimplemented from IReader. Definition at line 202 of file AbstractReader.d. References memory. |
|
Set the allocator to use for array management. Arrays are always allocated by the IReader. That is, you cannot read data into an array slice (for example). Instead, a number of IArrayAllocator classes are available to manage memory allocation when reading array content. By default, an IReader will allocate each array from the heap. You can change that behavior by calling this method with an IArrayAllocator of choice. For instance, there is a BufferAllocator which will slice an array directly from the buffer where possible. Also available is the record-oriented SliceAllocator, which slices memory from within a pre-allocated heap area, and should be reset by the client code after each record has been read (to avoid unnecessary growth). See ArrayAllocator for more information. Reimplemented from IReader. Definition at line 229 of file AbstractReader.d. |
|
Set the configured IStringDecoder. These are intended to be used as a conversion mechanism between various character representations. They are also expected to be used for the process of applying character encodings. See IStringDecoder. Reimplemented from IReader. Definition at line 247 of file AbstractReader.d. References IStringDecoder::char16(), AbstractReader::StringDecoder::char16, IStringDecoder::char32(), AbstractReader::StringDecoder::char32, IStringDecoder::char8(), AbstractReader::StringDecoder::char8, and string. |
|
Push the size (in bytes) to use for the next array-read. By default, array sizes are read from the input stream, so this is the means by which one may specify the size where the stream is not formatted in such a manner.
Reimplemented from IReader. Definition at line 271 of file AbstractReader.d. References pushed. |
|
Read and return an integer from the input stream. This can be used to extract the length of a subsequent array. Reimplemented from IReader. Definition at line 287 of file AbstractReader.d. |
|
Wait for something to arrive in the buffer. This may stall the current thread forever, although usage of SocketConduit will take advantage of the timeout facilities provided there. Reimplemented from IReader. Definition at line 306 of file AbstractReader.d. References IBuffer::get(). |
|
Extract a readable class from the current read-position Reimplemented from IReader. Definition at line 317 of file AbstractReader.d. References IReadable::read(). Referenced by length(), AbstractReader::VersionUseShiftOperators::opShr(), testBuffer(), testConduitFilters(), testHttpClient(), and testRandomAccess(). |
|
Extract a boolean value from the current read-position Reimplemented from IReader. Definition at line 330 of file AbstractReader.d. References AbstractReader::NumericDecoder::int1, and numeric. |
|
Extract an unsigned byte value from the current read-position Reimplemented from IReader. Definition at line 342 of file AbstractReader.d. References AbstractReader::NumericDecoder::int8u, and numeric. |
|
Extract a byte value from the current read-position Reimplemented from IReader. Definition at line 354 of file AbstractReader.d. References AbstractReader::NumericDecoder::int8, and numeric. |
|
Extract an unsigned short value from the current read-position Reimplemented from IReader. Definition at line 366 of file AbstractReader.d. References AbstractReader::NumericDecoder::int16u, and numeric. |
|
Extract a short value from the current read-position Reimplemented from IReader. Definition at line 378 of file AbstractReader.d. References AbstractReader::NumericDecoder::int16, and numeric. |
|
Extract a unsigned int value from the current read-position Reimplemented from IReader. Definition at line 390 of file AbstractReader.d. References AbstractReader::NumericDecoder::int32u, and numeric. |
|
Extract an int value from the current read-position Reimplemented from IReader. Definition at line 402 of file AbstractReader.d. References AbstractReader::NumericDecoder::int32, and numeric. |
|
Extract an unsigned long value from the current read-position Reimplemented from IReader. Definition at line 414 of file AbstractReader.d. References AbstractReader::NumericDecoder::int64u, and numeric. |
|
Extract a long value from the current read-position Reimplemented from IReader. Definition at line 426 of file AbstractReader.d. References AbstractReader::NumericDecoder::int64, and numeric. |
|
Extract a float value from the current read-position Reimplemented from IReader. Definition at line 438 of file AbstractReader.d. References AbstractReader::NumericDecoder::float32, and numeric. |
|
Extract a double value from the current read-position Reimplemented from IReader. Definition at line 450 of file AbstractReader.d. References AbstractReader::NumericDecoder::float64, and numeric. |
|
Extract a real value from the current read-position Reimplemented from IReader. Definition at line 462 of file AbstractReader.d. References AbstractReader::NumericDecoder::float80, and numeric. |
|
Extract a char value from the current read-position Reimplemented from IReader. Definition at line 474 of file AbstractReader.d. References AbstractReader::StringDecoder::char8, and string. |
|
Extract a wide char value from the current read-position Reimplemented from IReader. Definition at line 486 of file AbstractReader.d. References AbstractReader::StringDecoder::char16, and string. |
|
Extract a double char value from the current read-position Reimplemented from IReader. Definition at line 498 of file AbstractReader.d. References AbstractReader::StringDecoder::char32, and string. |
|
Definition at line 508 of file AbstractReader.d. References IArrayAllocator::allocate(), AbstractReader::StringDecoder::char8, memory, and string. |
|
Reimplemented from IReader. Reimplemented in TextReader. Definition at line 518 of file AbstractReader.d. References IArrayAllocator::allocate(), AbstractReader::StringDecoder::char8, memory, and string. |
|
Reimplemented from IReader. Reimplemented in TextReader. Definition at line 528 of file AbstractReader.d. References IArrayAllocator::allocate(), AbstractReader::StringDecoder::char16, memory, and string. |
|
Reimplemented from IReader. Reimplemented in TextReader. Definition at line 538 of file AbstractReader.d. References IArrayAllocator::allocate(), AbstractReader::StringDecoder::char32, memory, and string. |
|
Definition at line 57 of file ArrayAllocator.d. |
|
Reimplemented from IArrayAllocator. Definition at line 66 of file ArrayAllocator.d. |
|
Reimplemented from IArrayAllocator. Definition at line 74 of file ArrayAllocator.d. |
|
Reimplemented from IArrayAllocator. Definition at line 83 of file ArrayAllocator.d. References BufferConverter, and IReader::length(). |
|
Definition at line 130 of file AbstractReader.d. Referenced by this(). |
|
Definition at line 131 of file AbstractReader.d. Referenced by this(). |
|
Definition at line 137 of file AbstractReader.d. |
|
Definition at line 140 of file AbstractReader.d. Referenced by get(), and setStringDecoder(). |
|
Definition at line 143 of file AbstractReader.d. Referenced by get(). |
|
Definition at line 146 of file AbstractReader.d. Referenced by get(), and getAllocator(). |
|
Definition at line 149 of file AbstractReader.d. |