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 booleanclosedprotected java.io.DataInputStreaminThe data input stream for the db protocol.protected java.io.DataOutputStreamoutThe 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) voidcloseConnection()Closes the connection.(package private) byte[]nextCommandFromServer(int timeout)Blocks until the next command is received from the server.(package private) voidsetup(java.io.InputStream rawin, java.io.OutputStream rawout)Sets up the stream connection with the given input/output stream.(package private) voidwriteCommandToServer(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.IOExceptionSets 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.IOExceptionWrites the given command to the server. The stream protocol flushes the byte array onto the stream.- Specified by:
writeCommandToServerin classRemoteDatabaseInterface- Throws:
java.io.IOException
-
nextCommandFromServer
byte[] nextCommandFromServer(int timeout) throws java.io.IOExceptionBlocks until the next command is received from the server. The stream protocol waits until we receive something from the server.- Specified by:
nextCommandFromServerin classRemoteDatabaseInterface- Throws:
java.io.IOException
-
closeConnection
void closeConnection() throws java.io.IOExceptionDescription copied from class:RemoteDatabaseInterfaceCloses the connection.- Specified by:
closeConnectionin classRemoteDatabaseInterface- Throws:
java.io.IOException
-
-