Package org.hsqldb.lib

Examples of org.hsqldb.lib.HsqlByteArrayOutputStream


            bitSize++;
        }

        bitMap                = new BitMap(bitSize, false);
        buffer                = new byte[pageSize + 12];
        byteArrayOutputStream = new HsqlByteArrayOutputStream(buffer);
    }
View Full Code Here


            int length = row.getStorageSize()
                         - ScriptWriterText.BYTES_LINE_SEP.length;

            rowOut.reset();

            HsqlByteArrayOutputStream out = rowOut.getOutputStream();

            out.fill(' ', length);
            out.write(ScriptWriterText.BYTES_LINE_SEP);
            dataFile.seek(row.getPos());
            dataFile.write(out.getBuffer(), 0, out.size());
        } catch (Throwable t) {
            throw Error.runtimeError(ErrorCode.U_S0500, t.getMessage());
        }
    }
View Full Code Here

        this.file      = new RandomAccessFile(name, accessMode);
        buffer         = new byte[bufferSize];
        ba             = new HsqlByteArrayInputStream(buffer);
        valueBuffer    = new byte[8];
        vbao           = new HsqlByteArrayOutputStream(valueBuffer);
        vbai           = new HsqlByteArrayInputStream(valueBuffer);
        fileDescriptor = file.getFD();
        fileLength     = length();

        readIntoBuffer();
View Full Code Here

        this.dataFile         = dataFile;
        this.textFileSettings = textFileSettings;
        this.rowIn            = rowIn;
        this.isReadOnly       = isReadOnly;
        this.buffer           = new HsqlByteArrayOutputStream(128);
    }
View Full Code Here

                    resultIn.readLobResults(session, inStream, rowIn);

                    resultOut = session.execute(resultIn);
                }

                HsqlByteArrayOutputStream memStream =
                    new HsqlByteArrayOutputStream();
                DataOutputStream tempOutput = new DataOutputStream(memStream);

                resultOut.write(session, tempOutput, rowOut);
                response.setHeader("Cache-Control", "no-cache");        // DB-traffic should not be cached by proxy's
                response.setContentType("application/octet-stream");
                response.setContentLength(memStream.size());

                // Only acquire output-stream after headers are set
                dataOut = new DataOutputStream(response.getOutputStream());

                memStream.writeTo(dataOut);

                iQueries++;
            } catch (HsqlException e) {}
            finally {
                if (dataOut != null) {
View Full Code Here

                return;
            }

            // TODO: when doing Keep-Alive connections, try to retain buffer
            HsqlByteArrayOutputStream memStream =
                new HsqlByteArrayOutputStream();
            DataOutputStream tempOutput = new DataOutputStream(memStream);

            resultOut.write(session, tempOutput, rowOut);

            DataOutputStream dataOut =
                new DataOutputStream(socket.getOutputStream());

            // Write HTTP response header
            String header = getHead(HEADER_OK, false,
                                    "application/octet-stream",
                                    memStream.size());

            dataOut.write(header.getBytes(ENCODING));

            // Write actual pay-load to response
            memStream.writeTo(dataOut);
            dataOut.close();

// patch-end 2.2.9 by Aart 2012-05-15
        } catch (Exception e) {
            server.printStackTrace(e);
View Full Code Here

            throw JDBCUtil.sqlException(ErrorCode.JDBC_INPUTSTREAM_ERROR, msg);
        }

        try {
            java.io.InputStream in = x.getBinaryStream();
            HsqlByteArrayOutputStream out = new HsqlByteArrayOutputStream(in,
                (int) length);

            setParameter(parameterIndex, out.toByteArray());
        } catch (Throwable e) {
            throw JDBCUtil.sqlException(ErrorCode.JDBC_INPUTSTREAM_ERROR,
                                    e.toString(), e);
        }
    }
View Full Code Here

            throw JDBCUtil.sqlException(ErrorCode.JDBC_INPUTSTREAM_ERROR, msg);
        }

        try {
            HsqlByteArrayOutputStream output;

            if (length < 0) {
                output = new HsqlByteArrayOutputStream(x);
            } else {
                output = new HsqlByteArrayOutputStream(x, (int) length);
            }
            setParameter(parameterIndex, output.toByteArray());
        } catch (Throwable e) {
            throw JDBCUtil.sqlException(ErrorCode.JDBC_INPUTSTREAM_ERROR,
                                    e.toString(), e);
        }
    }
View Full Code Here

        writeInt(-1);    // length placeholder
    }

    static OdbcPacketOutputStream newOdbcPacketOutputStream()
    throws IOException {
        return new OdbcPacketOutputStream(new HsqlByteArrayOutputStream());
    }
View Full Code Here

        dataOut.writeInt(databaseID);
        dataOut.writeLong(sessionID);
        dataOut.writeLong(lobID);
        dataOut.writeInt(subType);

        HsqlByteArrayOutputStream byteArrayOS =
            new HsqlByteArrayOutputStream(bufferLength);

        byteArrayOS.reset();
        byteArrayOS.write(stream, bufferLength);
        dataOut.writeLong(currentOffset);
        dataOut.writeLong(byteArrayOS.size());
        dataOut.write(byteArrayOS.getBuffer(), 0, byteArrayOS.size());

        currentOffset += byteArrayOS.size();

        if (byteArrayOS.size() < bufferLength) {
            return;
        }

        //
        while (true) {
            byteArrayOS.reset();
            byteArrayOS.write(stream, bufferLength);

            if (byteArrayOS.size() == 0) {
                break;
            }

            //
            dataOut.writeByte(mode);
            dataOut.writeInt(databaseID);
            dataOut.writeLong(sessionID);
            dataOut.writeLong(lobID);
            dataOut.writeInt(LobResultTypes.REQUEST_SET_BYTES);
            dataOut.writeLong(currentOffset);
            dataOut.writeLong(byteArrayOS.size());
            dataOut.write(byteArrayOS.getBuffer(), 0, byteArrayOS.size());

            currentOffset += byteArrayOS.size();

            if (byteArrayOS.size() < bufferLength) {
                break;
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.hsqldb.lib.HsqlByteArrayOutputStream

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.