Package com.mckoi.database.jdbc
Class StreamDatabaseInterface
- java.lang.Object
-
- com.mckoi.database.jdbc.RemoteDatabaseInterface
-
- com.mckoi.database.jdbc.StreamDatabaseInterface
-
- All Implemented Interfaces:
DatabaseInterface
,ProtocolConstants
- Direct Known Subclasses:
TCPStreamDatabaseInterface
class StreamDatabaseInterface extends RemoteDatabaseInterface
An stream implementation of an interface to a McKoi database. This is a stream based communication protocol.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.mckoi.database.jdbc.RemoteDatabaseInterface
RemoteDatabaseInterface.MByteArrayOutputStream, RemoteDatabaseInterface.ServerCommand
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
closed
protected java.io.DataInputStream
in
The data input stream for the db protocol.protected java.io.DataOutputStream
out
The data output stream for the db protocol.-
Fields inherited from interface com.mckoi.database.jdbc.ProtocolConstants
ACKNOWLEDGEMENT, AUTHENTICATION_ERROR, CLOSE, DATABASE_EVENT, DISPOSE_RESULT, DISPOSE_STREAMABLE_OBJECT, EXCEPTION, FAILED, PING, PUSH_STREAMABLE_OBJECT_PART, QUERY, RESULT_SECTION, SERVER_REQUEST, STREAMABLE_OBJECT_SECTION, SUCCESS, USER_AUTHENTICATION_FAILED, USER_AUTHENTICATION_PASSED
-
-
Constructor Summary
Constructors Constructor Description StreamDatabaseInterface()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) void
closeConnection()
Closes the connection.(package private) byte[]
nextCommandFromServer(int timeout)
Blocks until the next command is received from the server.(package private) void
setup(java.io.InputStream rawin, java.io.OutputStream rawout)
Sets up the stream connection with the given input/output stream.(package private) void
writeCommandToServer(byte[] command, int offset, int size)
Writes the given command to the server.-
Methods inherited from class com.mckoi.database.jdbc.RemoteDatabaseInterface
dispose, disposeResult, disposeStreamableObject, execQuery, getResultPart, getStreamableObjectPart, login, pushStreamableObjectPart
-
-
-
-
Method Detail
-
setup
void setup(java.io.InputStream rawin, java.io.OutputStream rawout) throws java.io.IOException
Sets up the stream connection with the given input/output stream.- Throws:
java.io.IOException
-
writeCommandToServer
void writeCommandToServer(byte[] command, int offset, int size) throws java.io.IOException
Writes the given command to the server. The stream protocol flushes the byte array onto the stream.- Specified by:
writeCommandToServer
in classRemoteDatabaseInterface
- Throws:
java.io.IOException
-
nextCommandFromServer
byte[] nextCommandFromServer(int timeout) throws java.io.IOException
Blocks until the next command is received from the server. The stream protocol waits until we receive something from the server.- Specified by:
nextCommandFromServer
in classRemoteDatabaseInterface
- Throws:
java.io.IOException
-
closeConnection
void closeConnection() throws java.io.IOException
Description copied from class:RemoteDatabaseInterface
Closes the connection.- Specified by:
closeConnection
in classRemoteDatabaseInterface
- Throws:
java.io.IOException
-
-