DeveelDB
20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
|
Reads a command block on the underlying stream that is constrained by a length marker preceeding the command. More...
Public Member Functions | |
LengthMarkedBufferedInputStream (IInputStream input) | |
override int | ReadByte () |
override void | Write (byte[] buffer, int offset, int count) |
override void | Flush () |
override long | Seek (long offset, SeekOrigin origin) |
override void | SetLength (long value) |
override int | Read (byte[] b, int off, int len) |
bool | PollForCommand (int maxSize) |
Checks to see if there is a complete command waiting on the input stream. More... | |
void | BlockForCommand () |
Blocks until a complete command has been read in. More... | |
Properties | |
override bool | CanRead [get] |
override bool | CanSeek [get] |
override bool | CanWrite [get] |
override long | Length [get] |
override long | Position [get, set] |
int | Available [get] |
Private Member Functions | |
void | EnsureCapacity (int newSize) |
Ensures that the buffer is large enough to store the given value. More... | |
void | HandleEndReached () |
Called when the end of the marked length is reached. More... | |
Private Attributes | |
const int | InitialBufferSize = 512 |
The initial buffer size of the internal input buffer. More... | |
readonly IInputStream | input |
The chained InputStream that is underneath this object. More... | |
byte[] | buf |
The buffer that is used to read in whatever is on the stream. More... | |
int | count |
The number of valid bytes in the buffer. More... | |
int | markedLength |
The area of the buffer that is marked as being an available command. If it's -1 then there is no area marked. More... | |
int | markedIndex |
The current index of the marked area that is being read. More... | |
Reads a command block on the underlying stream that is constrained by a length marker preceeding the command.
This can be used as a hack work around for non-blocking IO because we know ahead of time how much data makes up the next block of information over the stream.
Definition at line 16 of file LengthMarkedBufferedInputStream.cs.
|
inline |
Definition at line 48 of file LengthMarkedBufferedInputStream.cs.
|
inline |
Blocks until a complete command has been read in.
Definition at line 247 of file LengthMarkedBufferedInputStream.cs.
|
inlineprivate |
Ensures that the buffer is large enough to store the given value.
newSize |
If the buffer is not large enough this method grows it so it is big enough.
Definition at line 63 of file LengthMarkedBufferedInputStream.cs.
|
inline |
Definition at line 143 of file LengthMarkedBufferedInputStream.cs.
|
inlineprivate |
Called when the end of the marked length is reached.
It performs various maintenance operations to ensure the buffer consistency is maintained.
Assumes we are calling from a synchronized method.
Definition at line 86 of file LengthMarkedBufferedInputStream.cs.
|
inline |
Checks to see if there is a complete command waiting on the input stream.
maxSize | The maximum number of bytes we are allowing before an IOException is thrown. |
If this method returns true then it is safe to go ahead and process a single command from this stream. This will return true only once while there is a command pending until that command is completely read in.
Definition at line 204 of file LengthMarkedBufferedInputStream.cs.
|
inline |
Definition at line 154 of file LengthMarkedBufferedInputStream.cs.
|
inline |
Definition at line 98 of file LengthMarkedBufferedInputStream.cs.
|
inline |
Definition at line 146 of file LengthMarkedBufferedInputStream.cs.
|
inline |
Definition at line 150 of file LengthMarkedBufferedInputStream.cs.
|
inline |
Definition at line 118 of file LengthMarkedBufferedInputStream.cs.
|
private |
The buffer that is used to read in whatever is on the stream.
Definition at line 30 of file LengthMarkedBufferedInputStream.cs.
|
private |
The number of valid bytes in the buffer.
Definition at line 35 of file LengthMarkedBufferedInputStream.cs.
|
private |
The initial buffer size of the internal input buffer.
Definition at line 20 of file LengthMarkedBufferedInputStream.cs.
|
private |
The chained InputStream that is underneath this object.
Definition at line 25 of file LengthMarkedBufferedInputStream.cs.
|
private |
The current index of the marked area that is being read.
Definition at line 46 of file LengthMarkedBufferedInputStream.cs.
|
private |
The area of the buffer that is marked as being an available command. If it's -1 then there is no area marked.
Definition at line 41 of file LengthMarkedBufferedInputStream.cs.
|
get |
Definition at line 176 of file LengthMarkedBufferedInputStream.cs.
|
get |
Definition at line 122 of file LengthMarkedBufferedInputStream.cs.
|
get |
Definition at line 126 of file LengthMarkedBufferedInputStream.cs.
|
get |
Definition at line 130 of file LengthMarkedBufferedInputStream.cs.
|
get |
Definition at line 134 of file LengthMarkedBufferedInputStream.cs.
|
getset |
Definition at line 138 of file LengthMarkedBufferedInputStream.cs.