Examples of HsqlByteArrayOutputStream


Examples of org.hsqldb.lib.HsqlByteArrayOutputStream

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

        HsqlByteArrayOutputStream byteArrayOS =
            new HsqlByteArrayOutputStream(bufferLength);

        byteArrayOS.reset();
        byteArrayOS.write(reader, bufferLength / 2);

        //
        dataOut.writeLong(currentOffset);
        dataOut.writeLong(byteArrayOS.size() / 2);
        dataOut.write(byteArrayOS.getBuffer(), 0, byteArrayOS.size());

        currentOffset += byteArrayOS.size() / 2;

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

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

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

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

            currentOffset += byteArrayOS.size() / 2;

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

Examples of org.hsqldb.lib.HsqlByteArrayOutputStream

            throw Util.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 Util.sqlException(ErrorCode.JDBC_INPUTSTREAM_ERROR,
                                    e.toString());
        }
    }
View Full Code Here

Examples of org.hsqldb.lib.HsqlByteArrayOutputStream

            throw Util.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 Util.sqlException(ErrorCode.JDBC_INPUTSTREAM_ERROR,
                                    e.toString());
        }
    }
View Full Code Here

Examples of org.hsqldb.lib.HsqlByteArrayOutputStream

            return isBinary ? (Object) BinaryData.zeroLengthBinary
                            : "";
        }

        StringBuffer              sb = null;
        HsqlByteArrayOutputStream os = null;

        if (isBinary) {
            os = new HsqlByteArrayOutputStream();
        } else {
            sb = new StringBuffer();
        }

        int i = 0;

        for (; i < iLen && wildCardType[i] == 0; i++) {
            if (isBinary) {
                os.writeByte(cLike[i]);
            } else {
                sb.append(cLike[i]);
            }
        }

        if (i == 0) {
            return null;
        }

        return isBinary ? (Object) new BinaryData(os.toByteArray(), false)
                        : sb.toString();
    }
View Full Code Here

Examples of org.hsqldb.lib.HsqlByteArrayOutputStream

                                      InputStream stream) throws IOException {

        //
        long currentOffset = result.getOffset();
        int  bufferLength  = session.getStreamBlockSize();
        HsqlByteArrayOutputStream byteArrayOS =
            new HsqlByteArrayOutputStream(bufferLength);

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

            byte[] byteArray = byteArrayOS.getBuffer();

            if (byteArrayOS.size() < bufferLength) {
                byteArray = byteArrayOS.toByteArray();
            }

            Result actionResult =
                database.lobManager.setBytes(result.getLobID(), currentOffset,
                                             byteArray);

            currentOffset += byteArrayOS.size();

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

Examples of org.hsqldb.lib.HsqlByteArrayOutputStream

    public ScriptWriterEncode(Database db, String file, Crypto crypto) {

        super(db, file, false, false, false);

        this.crypto = crypto;
        byteOut     = new HsqlByteArrayOutputStream();
        isCrypt     = true;
    }
View Full Code Here

Examples of org.hsqldb.lib.HsqlByteArrayOutputStream

        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());
    }
View Full Code Here

Examples of org.hsqldb.lib.HsqlByteArrayOutputStream

        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

Examples of org.hsqldb.lib.HsqlByteArrayOutputStream

            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 (IOException e) {
            throw Error.runtimeError(ErrorCode.U_S0500, e.getMessage());
        }
    }
View Full Code Here

Examples of org.hsqldb.lib.HsqlByteArrayOutputStream

        this.dataFile         = dataFile;
        this.textFileSettings = textFileSettings;
        this.rowIn            = rowIn;
        this.isReadOnly       = isReadOnly;
        this.buffer           = new HsqlByteArrayOutputStream(128);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.