BufferedDirectReadFile

Buffered file to do direct IO reads.

Please read the module documentation for details.

Constructors

this
this(cstring path, ubyte[] buffer)

Constructs a new BufferedDirectReadFile.

this
this(cstring path, size_t buffer_blocks)

Constructs a new BufferedDirectReadFile allocating a new buffer.

Members

Classes

DirectReadFile
class DirectReadFile

File to do direct IO reads.

Functions

close
void close()

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

conduit
IConduit conduit()

Return the host conduit.

input
InputStream input()

Return the upstream sink.

load
void[] load(size_t max)

Throws IOException because is not implemented.

newFile
DirectReadFile newFile()

Instantiates the file object to be used to read from. 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 BufferedDirectReadFile file.

read
size_t read(void[] dst)

Read from stream to a destination array. The content read from the stream will be stored in the provided dst.

sync
void sync()

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

Mixins

__anonymous
mixin AlignedBufferedStream

Mixin for common functionality.

Variables

pending_index
size_t pending_index;

Internal pointer to data we already read but is still pending, waiting for a reader.

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 InputStream

read
size_t read(void[] dst)

Read from stream into a target array. The provided dst will be populated with content from the stream.

load
void[] load(size_t max)

Load the bits from a stream, and return them all in an array. The optional max value indicates the maximum number of bytes to be read.

input
InputStream input()

Return the upstream source.

Meta