Examples of HsqlByteArrayOutputStream


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

        if (x == null) {
            throw Util.sqlException(Trace.error(Trace.INVALID_JDBC_ARGUMENT,
                                                Trace.JDBC_NULL_STREAM));
        }

        HsqlByteArrayOutputStream out = null;

        try {
            out = new HsqlByteArrayOutputStream();

            int    size = 2048;
            byte[] buff = new byte[size];

            for (int left = length; left > 0; ) {
                int read = x.read(buff, 0, left > size ? size
                                                       : left);

                if (read == -1) {
                    break;
                }

                out.write(buff, 0, read);

                left -= read;
            }

            setParameter(parameterIndex, out.toByteArray());
        } catch (IOException e) {
            throw Util.sqlException(Trace.INPUTSTREAM_ERROR, e.toString());
        } finally {
            if (out != null) {
                try {
                    out.close();
                } catch (IOException e1) {}
            }
        }
    }
View Full Code Here

Examples of org.hsqldb.lib.HsqlByteArrayOutputStream

                         + length;

            throw Util.sqlException(Trace.INPUTSTREAM_ERROR, msg);
        }

        HsqlByteArrayOutputStream out = null;

        try {
            out = new HsqlByteArrayOutputStream();

            java.io.InputStream in       = x.getBinaryStream();
            int                 buffSize = 2048;
            byte[]              buff     = new byte[buffSize];

            for (int left = (int) length; left > 0; ) {
                int read = in.read(buff, 0, left > buffSize ? buffSize
                                                            : left);

                if (read == -1) {
                    break;
                }

                out.write(buff, 0, read);

                left -= read;
            }

            setParameter(i, out.toByteArray());
        } catch (IOException e) {
            throw Util.sqlException(Trace.INPUTSTREAM_ERROR, e.toString());
        } finally {
            if (out != null) {
                try {
                    out.close();
                } catch (IOException e1) {}
            }
        }
    }
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 (IOException e) {
            throw Util.sqlException(ErrorCode.JDBC_INPUTSTREAM_ERROR,
                                    e.toString());
        }
    }
View Full Code Here

Examples of org.hsqldb.lib.HsqlByteArrayOutputStream

                String msg = "Maximum Blob input length exceeded: " + length;

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

            HsqlByteArrayOutputStream output =
                new HsqlByteArrayOutputStream(x, (int) length);

            setParameter(parameterIndex, output.toByteArray());
        } catch (IOException e) {
            throw Util.sqlException(ErrorCode.JDBC_INPUTSTREAM_ERROR,
                                    e.toString());
        }
    }
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

        if (data == null) {
            return Result.newErrorResult(Error.error(ErrorCode.X_0F502));
        }

        long length = ((Long) data[1]).longValue();
        HsqlByteArrayOutputStream os =
            new HsqlByteArrayOutputStream(chars.length * 2);

        os.write(chars, 0, chars.length);

        Result result = setBytesBA(session, lobID, os.getBuffer(), offset * 2,
                                   os.getBuffer().length);

        if (result.isError()) {
            return result;
        }

View Full Code Here

Examples of org.hsqldb.lib.HsqlByteArrayOutputStream

            return isBinary ? 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 ? new BinaryData(os.toByteArray(), false)
                        : sb.toString();
    }
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

        try {
            Exception e = new Exception();

            throw e;
        } catch (Exception e) {
            HsqlByteArrayOutputStream os = new HsqlByteArrayOutputStream();
            PrintWriter               pw = new PrintWriter(os, true);

            e.printStackTrace(pw);

            return os.toString();
        }
    }
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.