Console.Conduit

Conduit for specifically handling the console devices. This takes care of certain implementation details on the Win32 platform.

Note that the console is fixed at UTF8 for both linux and Win32. The latter is actually UTF16 native, but it's just too much hassle for a developer to handle the distinction when it really should be a no-brainer. In particular, the Win32 console functions don't work with redirection. This causes additional difficulties that can be ameliorated by asserting console I/O is always UTF8, in all modes.

Constructors

this
this(size_t handle)

Associate this device with a given handle.

Members

Functions

read
size_t read(void[] dst)
Undocumented in source. Be warned that the author may not have intended to support it.
toString
immutable(char)[] toString()

Return the name of this conduit.

write
size_t write(const(void)[] src)
Undocumented in source. Be warned that the author may not have intended to support it.

Inherited Members

From Device

error
alias error = Conduit.error

expose superclass definition also

error
void error()

Throw an IOException noting the last error.

toString
immutable(char)[] toString()

Return the name of this device.

bufferSize
size_t bufferSize()

Return a preferred size for buffering conduit I/O.

IO
struct IO

Windows-specific code.

io
IO io;

Windows-specific code.

reopen
void reopen(Handle handle)

Allow adjustment of standard IO handles.

fileHandle
Handle fileHandle [@property getter]

Return the underlying OS handle of this Conduit.

dispose
void dispose()
detach
void detach()

Release the underlying file. Note that an exception is not thrown on error, as doing so can induce some spaggetti into error handling. Instead, we need to change this to return a bool instead, so the caller can decide what to do.

read
size_t read(void[] dst)

Read a chunk of bytes from the file into the provided array. Returns the number of bytes read, or Eof where there is no further data.

write
size_t write(const(void)[] src)

Write a chunk of bytes to the file from the provided array. Returns the number of bytes written, or Eof if the output is no longer available.

wait
size_t wait(scheduler.Type type, uint bytes, uint timeout)
handle
int handle;

Unix-specific code.

reopen
void reopen(Handle handle)

Allow adjustment of standard IO handles.

fileHandle
Handle fileHandle [@property getter]

Return the underlying OS handle of this Conduit.

detach
void detach()

Release the underlying file.

read
size_t read(void[] dst)

Read a chunk of bytes from the file into the provided array. Returns the number of bytes read, or Eof where there is no further data.

write
size_t write(const(void)[] src)

Write a chunk of bytes to the file from the provided array. Returns the number of bytes written, or Eof if the output is no longer available.

Meta