DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
Protected Member Functions | Protected Attributes | Package Functions | Private Attributes | List of all members
Deveel.Data.Client.StreamDatabaseInterface Class Reference

An stream implementation of an interface to a database. More...

Inheritance diagram for Deveel.Data.Client.StreamDatabaseInterface:
Deveel.Data.Client.TCPStreamDatabaseInterface

Protected Member Functions

override void SendCommand (byte[] command, int offset, int size)
 
override byte[] ReceiveCommand (int timeout)
 
override void CloseConnection ()
 

Protected Attributes

BinaryWriter output
 The data output stream for the db protocol. More...
 
BinaryReader input
 The data input stream for the db protocol. More...
 

Package Functions

 StreamDatabaseInterface (string initial_database)
 
void Setup (Stream rawin, Stream rawout)
 Sets up the stream connection with the given input/output stream. More...
 

Private Attributes

bool closed = false
 

Detailed Description

An stream implementation of an interface to a database.

This is a stream based communication protocol.

Definition at line 26 of file StreamDatabaseInterface.cs.

Constructor & Destructor Documentation

Deveel.Data.Client.StreamDatabaseInterface.StreamDatabaseInterface ( string  initial_database)
inlinepackage

Definition at line 27 of file StreamDatabaseInterface.cs.

28  : base(initial_database) {
29  }

Member Function Documentation

override void Deveel.Data.Client.StreamDatabaseInterface.CloseConnection ( )
inlineprotected

Definition at line 80 of file StreamDatabaseInterface.cs.

80  {
81  try {
82  if (output != null)
83  output.Close();
84  } finally {
85  if (input != null)
86  input.Close();
87 
88  closed = true;
89  }
90  }
BinaryReader input
The data input stream for the db protocol.
BinaryWriter output
The data output stream for the db protocol.
override byte [] Deveel.Data.Client.StreamDatabaseInterface.ReceiveCommand ( int  timeout)
inlineprotected

Definition at line 64 of file StreamDatabaseInterface.cs.

64  {
65  if (closed) {
66  throw new IOException("IDatabaseInterface is closed!");
67  }
68  try {
69  int commandLength = input.ReadInt32();
70  byte[] buf = new byte[commandLength];
71  input.Read(buf, 0, commandLength);
72  return buf;
73  } catch (NullReferenceException) {
74  Console.Out.WriteLine("Throwable generated at: " + this);
75  throw;
76  }
77  }
BinaryReader input
The data input stream for the db protocol.
override void Deveel.Data.Client.StreamDatabaseInterface.SendCommand ( byte[]  command,
int  offset,
int  size 
)
inlineprotected

Definition at line 57 of file StreamDatabaseInterface.cs.

57  {
58  output.Write(size);
59  output.Write(command, 0, size);
60  output.Flush();
61  }
BinaryWriter output
The data output stream for the db protocol.
void Deveel.Data.Client.StreamDatabaseInterface.Setup ( Stream  rawin,
Stream  rawout 
)
inlinepackage

Sets up the stream connection with the given input/output stream.

Parameters
rawin
rawout

Definition at line 47 of file StreamDatabaseInterface.cs.

47  {
48  if (rawin == null || rawout == null) {
49  throw new IOException("rawin or rawin is null");
50  }
51  // Get the input and output and wrap around Data streams.
52  input = new BinaryReader(new BufferedStream(rawin, 32768));
53  output = new BinaryWriter(new BufferedStream(rawout, 32768));
54  }
BinaryReader input
The data input stream for the db protocol.
BinaryWriter output
The data output stream for the db protocol.

Member Data Documentation

bool Deveel.Data.Client.StreamDatabaseInterface.closed = false
private

Definition at line 40 of file StreamDatabaseInterface.cs.

BinaryReader Deveel.Data.Client.StreamDatabaseInterface.input
protected

The data input stream for the db protocol.

Definition at line 38 of file StreamDatabaseInterface.cs.

BinaryWriter Deveel.Data.Client.StreamDatabaseInterface.output
protected

The data output stream for the db protocol.

Definition at line 34 of file StreamDatabaseInterface.cs.


The documentation for this class was generated from the following file: