FilterStream

A base class for streams that wrap a source stream with additional functionality.

The method implementations forward read/write/seek calls to the source stream. A FilterStream can change the position of the source stream arbitrarily and may not keep the source stream state in sync with the FilterStream, even upon flushing and closing the FilterStream. It is recommended to not make any assumptions about the state of the source position and read/write state after a FilterStream has acted upon it. Specifc subclasses of FilterStream should document how they modify the source stream and if any invariants hold true between the source and filter.

Constructors

this
this(Stream source)

Construct a FilterStream for the given source.

Members

Functions

close
void close()
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.
readBlock
size_t readBlock(void* buffer, size_t size)
Undocumented in source. Be warned that the author may not have intended to support it.
resetSource
void resetSource()

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

seek
ulong seek(long offset, SeekPos whence)
Undocumented in source. Be warned that the author may not have intended to support it.
source
Stream source()

Get the current source stream.

source
void source(Stream s)

Set the current source stream.

writeBlock
size_t writeBlock(void* buffer, size_t size)
Undocumented in source. Be warned that the author may not have intended to support it.

Properties

available
size_t available [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.

Variables

nestClose
bool nestClose;

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

Inherited Members

From Stream

readable
bool readable;

Indicates whether this stream can be read from.

writeable
bool writeable;

Indicates whether this stream can be written to.

seekable
bool seekable;

Indicates whether this stream can be sought within.

isopen
bool isopen;

Indicates whether this stream is open.

readEOF
bool readEOF;

Indicates whether this stream is at eof after the last read attempt.

prevCr
bool prevCr;

For a non-seekable stream indicates that the last readLine or readLineW ended on a '\r' character.

readBlock
size_t readBlock(void* buffer, size_t size)

Read up to size bytes into the buffer and return the number of bytes actually read. A return value of 0 indicates end-of-file.

readExact
void readExact(void* buffer, size_t size)
Undocumented in source. Be warned that the author may not have intended to support it.
read
size_t read(ubyte[] buffer)
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(ifloat x)
Undocumented in source. Be warned that the author may not have intended to support it.
read
void read(idouble x)
Undocumented in source. Be warned that the author may not have intended to support it.
read
void read(ireal x)
Undocumented in source. Be warned that the author may not have intended to support it.
read
void read(cfloat x)
Undocumented in source. Be warned that the author may not have intended to support it.
read
void read(cdouble x)
Undocumented in source. Be warned that the author may not have intended to support it.
read
void read(creal 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.
read
void read(char[] s)
Undocumented in source. Be warned that the author may not have intended to support it.
read
void read(wchar[] s)
Undocumented in source. Be warned that the author may not have intended to support it.
readLine
char[] readLine()
Undocumented in source. Be warned that the author may not have intended to support it.
readLine
char[] readLine(char[] result)
Undocumented in source. Be warned that the author may not have intended to support it.
readLineW
wchar[] readLineW()
Undocumented in source. Be warned that the author may not have intended to support it.
readLineW
wchar[] readLineW(wchar[] result)
Undocumented in source. Be warned that the author may not have intended to support it.
opApply
int opApply(int delegate(ref char[] line) dg)
Undocumented in source. Be warned that the author may not have intended to support it.
opApply
int opApply(int delegate(ref ulong n, ref char[] line) dg)
Undocumented in source. Be warned that the author may not have intended to support it.
opApply
int opApply(int delegate(ref wchar[] line) dg)
Undocumented in source. Be warned that the author may not have intended to support it.
opApply
int opApply(int delegate(ref ulong n, ref wchar[] line) dg)
Undocumented in source. Be warned that the author may not have intended to support it.
readString
char[] readString(size_t length)
Undocumented in source. Be warned that the author may not have intended to support it.
readStringW
wchar[] readStringW(size_t length)
Undocumented in source. Be warned that the author may not have intended to support it.
ungetAvailable
bool ungetAvailable()
Undocumented in source. Be warned that the author may not have intended to support it.
getc
char getc()
Undocumented in source. Be warned that the author may not have intended to support it.
getcw
wchar getcw()
Undocumented in source. Be warned that the author may not have intended to support it.
ungetc
char ungetc(char c)
Undocumented in source. Be warned that the author may not have intended to support it.
ungetcw
wchar ungetcw(wchar c)
Undocumented in source. Be warned that the author may not have intended to support it.
vreadf
int vreadf(TypeInfo[] arguments, va_list args)
Undocumented in source. Be warned that the author may not have intended to support it.
readf
int readf(...)
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.
writeBlock
size_t writeBlock(void* buffer, size_t size)

Write up to size bytes from buffer in the stream, returning the actual number of bytes that were written.

writeExact
void writeExact(void* buffer, size_t size)
Undocumented in source. Be warned that the author may not have intended to support it.
write
size_t write(const(ubyte)[] buffer)
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(ifloat x)
Undocumented in source. Be warned that the author may not have intended to support it.
write
void write(idouble x)
Undocumented in source. Be warned that the author may not have intended to support it.
write
void write(ireal x)
Undocumented in source. Be warned that the author may not have intended to support it.
write
void write(cfloat x)
Undocumented in source. Be warned that the author may not have intended to support it.
write
void write(cdouble x)
Undocumented in source. Be warned that the author may not have intended to support it.
write
void write(creal 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.
write
void write(const(char)[] s)
Undocumented in source. Be warned that the author may not have intended to support it.
write
void write(const(wchar)[] s)
Undocumented in source. Be warned that the author may not have intended to support it.
writeLine
void writeLine(const(char)[] s)
Undocumented in source. Be warned that the author may not have intended to support it.
writeLineW
void writeLineW(const(wchar)[] s)
Undocumented in source. Be warned that the author may not have intended to support it.
writeString
void writeString(const(char)[] s)
Undocumented in source. Be warned that the author may not have intended to support it.
writeStringW
void writeStringW(const(wchar)[] s)
Undocumented in source. Be warned that the author may not have intended to support it.
vprintf
size_t vprintf(const(char)[] format, va_list args)
Undocumented in source. Be warned that the author may not have intended to support it.
printf
size_t printf(const(char)[] format, ...)
Undocumented in source. Be warned that the author may not have intended to support it.
writef
OutputStream writef(...)
Undocumented in source. Be warned that the author may not have intended to support it.
writefln
OutputStream writefln(...)
Undocumented in source. Be warned that the author may not have intended to support it.
writefx
OutputStream writefx(TypeInfo[] arguments, va_list argptr, int newline)
Undocumented in source. Be warned that the author may not have intended to support it.
copyFrom
void copyFrom(Stream s)

Copies all data from s into this stream. This may throw ReadException or WriteException on failure. This restores the file position of s so that it is unchanged.

copyFrom
void copyFrom(Stream s, ulong count)

Copy a specified number of bytes from the given stream into this one. This may throw ReadException or WriteException on failure. Unlike the previous form, this doesn't restore the file position of s.

seek
ulong seek(long offset, SeekPos whence)

Change the current position of the stream. whence is either SeekPos.Set, in which case the offset is an absolute index from the beginning of the stream, SeekPos.Current, in which case the offset is a delta from the current position, or SeekPos.End, in which case the offset is a delta from the end of the stream (negative or zero offsets only make sense in that case). This returns the new file position.

seekSet
ulong seekSet(long offset)

Aliases for their normal seek counterparts.

seekCur
ulong seekCur(long offset)
Undocumented in source. Be warned that the author may not have intended to support it.
seekEnd
ulong seekEnd(long offset)
Undocumented in source. Be warned that the author may not have intended to support it.
position
ulong position [@property setter]

Sets file position. Equivalent to calling seek(pos, SeekPos.Set).

position
ulong position [@property getter]

Returns current file position. Equivalent to seek(0, SeekPos.Current).

size
ulong size [@property getter]

Retrieve the size of the stream in bytes. The stream must be seekable or a SeekException is thrown.

eof
bool eof [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
isOpen
bool isOpen [@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.
close
void close()
Undocumented in source. Be warned that the author may not have intended to support it.
toString
string toString()

Read the entire stream and return it as a string. If the stream is not seekable the contents from the current position to eof is read and returned.

toHash
size_t toHash()

Get a hash of the stream by reading each byte and using it in a CRC-32 checksum.

assertReadable
void assertReadable()
Undocumented in source. Be warned that the author may not have intended to support it.
assertWriteable
void assertWriteable()
Undocumented in source. Be warned that the author may not have intended to support it.
assertSeekable
void assertSeekable()
Undocumented in source. Be warned that the author may not have intended to support it.

Meta