Package org.hsqldb.lib

Examples of org.hsqldb.lib.DataOutputStream


        try {
            socket.setTcpNoDelay(true);

            dataInput = new DataInputStream(
                new BufferedInputStream(socket.getInputStream()));
            dataOutput = new DataOutputStream(socket.getOutputStream());

            int firstInt = handshake();

            switch (streamProtocol) {
View Full Code Here


            socket = HsqlSocketFactory.getInstance(isTLS).createSocket(host,
                                                   port);

            socket.setTcpNoDelay(true);

            dataOutput = new DataOutputStream(socket.getOutputStream());
            dataInput = new DataInputStream(
                new BufferedInputStream(socket.getInputStream()));

            handshake();
        } catch (Exception e) {
View Full Code Here

                    || type == ResultConstants.RESETSESSION) {
                return;
            }

//
            DataOutputStream dataOut =
                new DataOutputStream(socket.getOutputStream());
            String header = getHead(HEADER_OK, false,
                                    "application/octet-stream", rowOut.size());

            dataOut.write(header.getBytes(ENCODING));
            dataOut.flush();
            resultOut.write(session, dataOut, rowOut);
            dataOut.close();
        } catch (Exception e) {
            server.printStackTrace(e);
        }
    }
View Full Code Here

                       HttpServletResponse response)
                       throws IOException, ServletException {

        synchronized (this) {
            DataInputStream  inStream = null;
            DataOutputStream dataOut  = null;

            try {

                // fredt@users - the servlet container, Resin does not return all
                // the bytes with one call to input.read(b,0,len) when len > 8192
                // bytes, the loop in the Result.read() method handles this
                inStream = new DataInputStream(request.getInputStream());

                int  databaseID = inStream.readInt();
                long sessionID  = inStream.readLong();
                int  mode       = inStream.readByte();
                Session session = DatabaseManager.getSession(databaseID,
                    sessionID);
                Result resultIn = Result.newResult(session, mode, inStream,
                                                   rowIn);

                resultIn.setDatabaseId(databaseID);
                resultIn.setSessionId(sessionID);

                Result resultOut;

                if (resultIn.getType() == ResultConstants.CONNECT) {
                    try {
                        session = DatabaseManager.newSession(
                            dbType, dbPath, resultIn.getMainString(),
                            resultIn.getSubString(), new HsqlProperties(),
                            resultIn.getZoneString(),
                            resultIn.getUpdateCount());

                        resultIn.readAdditionalResults(null, inStream, rowIn);

                        resultOut = Result.newConnectionAcknowledgeResponse(
                            session.getDatabase(), session.getId(),
                            session.getDatabase().getDatabaseID());
                    } catch (HsqlException e) {
                        resultOut = Result.newErrorResult(e);
                    }
                } else {
                    int  dbId      = resultIn.getDatabaseId();
                    long sessionId = resultIn.getSessionId();

                    session = DatabaseManager.getSession(dbId, sessionId);

                    resultIn.readLobResults(session, inStream, rowIn);

                    resultOut = session.execute(resultIn);
                }

                //
                response.setContentType("application/octet-stream");
                response.setContentLength(rowOut.size());

                //
                dataOut = new DataOutputStream(response.getOutputStream());

                resultOut.write(session, dataOut, rowOut);

                iQueries++;
            } catch (HsqlException e) {}
            finally {
                if (dataOut != null) {
                    dataOut.close();
                }

                if (inStream != null) {
                    inStream.close();
                }
View Full Code Here

        try {
            socket.setTcpNoDelay(true);

            dataInput = new DataInputStream(
                new BufferedInputStream(socket.getInputStream()));
            dataOutput = new DataOutputStream(socket.getOutputStream());

            int firstInt = handshake();

            switch (streamProtocol) {
View Full Code Here

        rowOut = new RowOutputBinary();
    }

    protected void writeSingleColumnResult(Result r) throws IOException {

        DataOutputStream dataOutput = new DataOutputStream(fileStreamOut);

        rowOut.reset();
        r.write(dataOutput, rowOut);
        dataOutput.flush();
    }
View Full Code Here

TOP

Related Classes of org.hsqldb.lib.DataOutputStream

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.