BufferedDirectWriteFile

Buffered file to do direct I/O writes.

Please read the module documentation for details.

Constructors

this
this(cstring path, ubyte[] buffer)

Constructs a new BufferedDirectWriteFile.

this
this(cstring path, size_t buffer_blocks)

Constructs a new BufferedDirectWriteFile allocating a new buffer.

Members

Classes

DirectWriteFile
class DirectWriteFile

File to do direct IO writes.

Functions

close
void close()

Close the underlying file, but calling flushWithPadding() and sync() first.

conduit
IConduit conduit()

Return the host conduit.

flushWithPadding
size_t flushWithPadding(ubyte padding_byte)

Write the current buffer rounding to the block size (and setting the padding bytes to padding_byte).

newFile
DirectWriteFile newFile()

Instantiates the file object to be used to write to. This method may be overridden by derived classes, allowing different types of file to be used with this class.

open
void open(cstring path)

Open a BufferedDirectWriteFile file.

output
OutputStream output()

Return the upstream sink.

path
cstring path()
sync
void sync()

Instructs the OS to flush it's internal buffers to the disk device.

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

Write to stream from a source array. The provided src content will be written to the stream.

Mixins

__anonymous
mixin AlignedBufferedStream

Mixin for common functionality.

Mixed In Members

From mixin AlignedBufferedStream

BLOCK_SIZE
anonymousenum BLOCK_SIZE

Block size.

buffer
ubyte[] buffer;

Internal buffer (the size needs to be multiple of the block size).

free_index
size_t free_index;

Internal pointer to the next byte of the buffer that is free.

setBuffer
void setBuffer(ubyte[] buffer)

Construct the buffer using an existing buffer.

createBuffer
void createBuffer(size_t buffer_blocks)

Construct the buffer with a specified size.

isAligned
bool isAligned(const(void)* ptr)

Return true if the pointer is aligned to the block size.

seek
long seek(long offset, Anchor anchor)

Throws an IOException because is not implemented.

flush
IOStream flush()

Throws an IOException because is not implemented.

copy
OutputStream copy(InputStream src, size_t max)

Throws IOException because is not implemented.

Inherited Members

From OutputStream

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

Write to stream from a source array. The provided src content will be written to the stream.

copy
OutputStream copy(InputStream src, size_t max)

Transfer the content of another stream to this one. Returns a reference to this class, and throws IOException on failure.

output
OutputStream output()

Return the upstream sink.

Meta