EndianStream

This subclass wraps a stream with big-endian or little-endian byte order swapping.

UTF Byte-Order-Mark (BOM) signatures can be read and deduced or written. Note that an EndianStream should not be used as the source of another FilterStream since a FilterStream call the source with byte-oriented read/write requests and the EndianStream will not perform any byte swapping. The EndianStream reads and writes binary data (non-getc functions) in a one-to-one manner with the source stream so the source stream's position and state will be kept in sync with the EndianStream if only non-getc functions are called.

Constructors

this
this(Stream source, Endian end)

Create the endian stream for the source stream source with endianness end. The default endianness is the native byte order. The Endian type is defined in the std.system module.

Members

Functions

fixBO
void fixBO(const(void)* buffer, size_t size)

Correct the byte order of buffer to match native endianness. size must be even.

fixBlockBO
void fixBlockBO(void* buffer, uint size, size_t repeat)

Correct the byte order of the given buffer in blocks of the given size and repeated the given number of times. size must be even.

getcw
wchar getcw()
Undocumented in source. Be warned that the author may not have intended to support it.
read
void read(byte x)
Undocumented in source. Be warned that the author may not have intended to support it.
read
void read(ubyte x)
Undocumented in source. Be warned that the author may not have intended to support it.
read
void read(short x)
Undocumented in source. Be warned that the author may not have intended to support it.
read
void read(ushort x)
Undocumented in source. Be warned that the author may not have intended to support it.
read
void read(int x)
Undocumented in source. Be warned that the author may not have intended to support it.
read
void read(uint x)
Undocumented in source. Be warned that the author may not have intended to support it.
read
void read(long x)
Undocumented in source. Be warned that the author may not have intended to support it.
read
void read(ulong x)
Undocumented in source. Be warned that the author may not have intended to support it.
read
void read(float x)
Undocumented in source. Be warned that the author may not have intended to support it.
read
void read(double x)
Undocumented in source. Be warned that the author may not have intended to support it.
read
void read(real x)
Undocumented in source. Be warned that the author may not have intended to support it.
read
void read(char x)
Undocumented in source. Be warned that the author may not have intended to support it.
read
void read(wchar x)
Undocumented in source. Be warned that the author may not have intended to support it.
read
void read(dchar x)
Undocumented in source. Be warned that the author may not have intended to support it.
readBOM
int readBOM(int ungetCharSize)

Return -1 if no BOM and otherwise read the BOM and return it.

readStringW
wchar[] readStringW(size_t length)
Undocumented in source. Be warned that the author may not have intended to support it.
write
void write(byte x)
Undocumented in source. Be warned that the author may not have intended to support it.
write
void write(ubyte x)
Undocumented in source. Be warned that the author may not have intended to support it.
write
void write(short x)
Undocumented in source. Be warned that the author may not have intended to support it.
write
void write(ushort x)
Undocumented in source. Be warned that the author may not have intended to support it.
write
void write(int x)
Undocumented in source. Be warned that the author may not have intended to support it.
write
void write(uint x)
Undocumented in source. Be warned that the author may not have intended to support it.
write
void write(long x)
Undocumented in source. Be warned that the author may not have intended to support it.
write
void write(ulong x)
Undocumented in source. Be warned that the author may not have intended to support it.
write
void write(float x)
Undocumented in source. Be warned that the author may not have intended to support it.
write
void write(double x)
Undocumented in source. Be warned that the author may not have intended to support it.
write
void write(real x)
Undocumented in source. Be warned that the author may not have intended to support it.
write
void write(char x)
Undocumented in source. Be warned that the author may not have intended to support it.
write
void write(wchar x)
Undocumented in source. Be warned that the author may not have intended to support it.
write
void write(dchar x)
Undocumented in source. Be warned that the author may not have intended to support it.
writeBOM
void writeBOM(BOM b)

Write the specified BOM b to the source stream.

writeStringW
void writeStringW(const(wchar)[] str)
Undocumented in source. Be warned that the author may not have intended to support it.

Properties

eof
bool eof [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
size
ulong size [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.

Variables

endian
Endian endian;

Endianness property of the source stream.

Inherited Members

From FilterStream

nestClose
bool nestClose;

Property indicating when this stream closes to close the source stream as well. Defaults to true.

source
Stream source()

Get the current source stream.

source
void source(Stream s)

Set the current source stream.

resetSource
void resetSource()

Indicates the source stream changed state and that this stream should reset any readable, writeable, seekable, isopen and buffering flags.

readBlock
size_t readBlock(void* buffer, size_t size)
Undocumented in source. Be warned that the author may not have intended to support it.
writeBlock
size_t writeBlock(void* buffer, size_t size)
Undocumented in source. Be warned that the author may not have intended to support it.
close
void close()
Undocumented in source. Be warned that the author may not have intended to support it.
seek
ulong seek(long offset, SeekPos whence)
Undocumented in source. Be warned that the author may not have intended to support it.
available
size_t available [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
flush
void flush()
Undocumented in source. Be warned that the author may not have intended to support it.

Meta