• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java HsqlByteArrayOutputStream类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.hsqldb.lib.HsqlByteArrayOutputStream的典型用法代码示例。如果您正苦于以下问题:Java HsqlByteArrayOutputStream类的具体用法?Java HsqlByteArrayOutputStream怎么用?Java HsqlByteArrayOutputStream使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



HsqlByteArrayOutputStream类属于org.hsqldb.lib包,在下文中一共展示了HsqlByteArrayOutputStream类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: RAFile

import org.hsqldb.lib.HsqlByteArrayOutputStream; //导入依赖的package包/类
RAFile(EventLogInterface logger, String name, boolean readonly,
        boolean extendLengthToBlock,
        boolean commitOnChange) throws FileNotFoundException, IOException {

    this.logger       = logger;
    this.fileName     = name;
    this.readOnly     = readonly;
    this.extendLength = extendLengthToBlock;

    String accessMode = readonly ? "r"
                                 : commitOnChange ? "rws"
                                                  : "rw";

    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();
}
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:25,代码来源:RAFile.java


示例2: RAShadowFile

import org.hsqldb.lib.HsqlByteArrayOutputStream; //导入依赖的package包/类
RAShadowFile(Database database, RandomAccessInterface source,
             String pathName, long maxSize, int pageSize) {

    this.database = database;
    this.pathName = pathName;
    this.source   = source;
    this.pageSize = pageSize;
    this.maxSize  = maxSize;

    int bitSize = (int) (maxSize / pageSize);

    if (maxSize % pageSize != 0) {
        bitSize++;
    }

    bitMap                = new BitMap(bitSize, false);
    buffer                = new byte[pageSize + headerSize];
    byteArrayOutputStream = new HsqlByteArrayOutputStream(buffer);
}
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:20,代码来源:RAShadowFile.java


示例3: clearRowImage

import org.hsqldb.lib.HsqlByteArrayOutputStream; //导入依赖的package包/类
private void clearRowImage(CachedObject row) {

        try {
            int length = row.getStorageSize();
            int count  = length - textFileSettings.bytesForLineEnd.length;

            rowOut.reset();

            HsqlByteArrayOutputStream out = rowOut.getOutputStream();

            for (; count > 0; count -= textFileSettings.bytesForSpace.length) {
                out.write(textFileSettings.bytesForSpace);
            }

            out.write(textFileSettings.bytesForLineEnd);
            dataFile.seek(row.getPos());
            dataFile.write(out.getBuffer(), 0, out.size());
        } catch (Throwable t) {
            throw Error.runtimeError(ErrorCode.U_S0500, t.getMessage());
        }
    }
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:22,代码来源:TextCache.java


示例4: setBlobForBinaryParameter

import org.hsqldb.lib.HsqlByteArrayOutputStream; //导入依赖的package包/类
/**
 * Converts a blob to binary data for non-blob binary parameters.
 */
private void setBlobForBinaryParameter(int parameterIndex,
        Blob x) throws SQLException {

    if (x instanceof JDBCBlob) {
        setParameter(parameterIndex, ((JDBCBlob) x).data());

        return;
    } else if (x == null) {
        setParameter(parameterIndex, null);

        return;
    }

    final long length = x.length();

    if (length > Integer.MAX_VALUE) {
        String msg = "Maximum Blob input octet length exceeded: " + length;    // NOI18N

        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());
        out.close();
    } catch (Throwable e) {
        throw JDBCUtil.sqlException(ErrorCode.JDBC_INPUTSTREAM_ERROR,
                                e.toString(), e);
    }
}
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:37,代码来源:JDBCPreparedStatement.java


示例5: write

import org.hsqldb.lib.HsqlByteArrayOutputStream; //导入依赖的package包/类
protected void write(Result r) throws IOException, HsqlException {

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

        r.write(this, tempOutput, rowOut);
        httpConnection.setRequestMethod("POST");
        httpConnection.setDoOutput(true);
        httpConnection.setUseCaches(false);

        //httpConnection.setRequestProperty("Accept-Encoding", "gzip");
        httpConnection.setRequestProperty("Content-Type",
                                          "application/octet-stream");
        httpConnection.setRequestProperty("Content-Length",
                                          String.valueOf(IDLENGTH
                                              + memStream.size()));

        dataOutput = new DataOutputStream(httpConnection.getOutputStream());

        dataOutput.writeInt(r.getDatabaseId());
        dataOutput.writeLong(r.getSessionId());
        memStream.writeTo(dataOutput);
        dataOutput.flush();
    }
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:25,代码来源:ClientConnectionHTTP.java


示例6: clearRowImage

import org.hsqldb.lib.HsqlByteArrayOutputStream; //导入依赖的package包/类
private void clearRowImage(CachedObject row) {

        try {
            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());
        }
    }
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:19,代码来源:TextCache.java


示例7: setBlobForBinaryParameter

import org.hsqldb.lib.HsqlByteArrayOutputStream; //导入依赖的package包/类
/**
 * Converts a blob to binary data for non-blob binary parameters.
 */
private void setBlobForBinaryParameter(int parameterIndex,
        Blob x) throws SQLException {

    if (x instanceof JDBCBlob) {
        setParameter(parameterIndex, ((JDBCBlob) x).data());

        return;
    } else if (x == null) {
        setParameter(parameterIndex, null);

        return;
    }
    checkSetParameterIndex(parameterIndex, true);

    final long length = x.length();

    if (length > Integer.MAX_VALUE) {
        String msg = "Maximum Blob input octet length exceeded: " + length;    // NOI18N

        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());
    }
}
 
开发者ID:s-store,项目名称:s-store,代码行数:37,代码来源:JDBCPreparedStatement.java


示例8: RAFile

import org.hsqldb.lib.HsqlByteArrayOutputStream; //导入依赖的package包/类
RAFile(Database database, String name, boolean readonly,
        boolean extendLengthToBlock,
        boolean commitOnChange) throws FileNotFoundException, IOException {

    this.database     = database;
    this.fileName     = name;
    this.readOnly     = readonly;
    this.extendLength = extendLengthToBlock;

    String accessMode = readonly ? "r"
                                 : commitOnChange ? "rws"
                                                  : "rw";

    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();
}
 
开发者ID:Julien35,项目名称:dev-courses,代码行数:25,代码来源:RAFile.java


示例9: RAShadowFile

import org.hsqldb.lib.HsqlByteArrayOutputStream; //导入依赖的package包/类
RAShadowFile(Database database, RandomAccessInterface source,
             String pathName, long maxSize, int pageSize) {

    this.database = database;
    this.pathName = pathName;
    this.source   = source;
    this.pageSize = pageSize;
    this.maxSize  = maxSize;

    int bitSize = (int) (maxSize / pageSize);

    if (maxSize % pageSize != 0) {
        bitSize++;
    }

    bitMap                = new BitMap(bitSize, false);
    buffer                = new byte[pageSize + 12];
    byteArrayOutputStream = new HsqlByteArrayOutputStream(buffer);
}
 
开发者ID:Julien35,项目名称:dev-courses,代码行数:20,代码来源:RAShadowFile.java


示例10: clearRowImage

import org.hsqldb.lib.HsqlByteArrayOutputStream; //导入依赖的package包/类
private void clearRowImage(CachedObject row) {

        try {
            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());
        }
    }
 
开发者ID:Julien35,项目名称:dev-courses,代码行数:19,代码来源:TextCache.java


示例11: setBlobForBinaryParameter

import org.hsqldb.lib.HsqlByteArrayOutputStream; //导入依赖的package包/类
/**
 * Converts a blob to binary data for non-blob binary parameters.
 */
private void setBlobForBinaryParameter(int parameterIndex,
        Blob x) throws SQLException {

    if (x instanceof JDBCBlob) {
        setParameter(parameterIndex, ((JDBCBlob) x).data());

        return;
    } else if (x == null) {
        setParameter(parameterIndex, null);

        return;
    }

    final long length = x.length();

    if (length > Integer.MAX_VALUE) {
        String msg = "Maximum Blob input octet length exceeded: " + length;    // NOI18N

        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);
    }
}
 
开发者ID:Julien35,项目名称:dev-courses,代码行数:36,代码来源:JDBCPreparedStatement.java


示例12: free

import org.hsqldb.lib.HsqlByteArrayOutputStream; //导入依赖的package包/类
/**
 *
 */
void free(CachedRow r) throws HsqlException {

    if (storeOnInsert &&!isIndexingSource) {
        int pos = r.iPos;
        int length = r.storageSize
                     - ScriptWriterText.BYTES_LINE_SEP.length;

        rowOut.reset();

        HsqlByteArrayOutputStream out = rowOut.getOutputStream();

        try {
            out.fill(' ', length);
            out.write(ScriptWriterText.BYTES_LINE_SEP);
            dataFile.seek(pos);
            dataFile.write(out.getBuffer(), 0, out.size());
        } catch (IOException e) {
            throw (Trace.error(Trace.FILE_IO_ERROR, e.toString()));
        }
    }

    remove(r);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:27,代码来源:TextCache.java


示例13: getStackTrace

import org.hsqldb.lib.HsqlByteArrayOutputStream; //导入依赖的package包/类
/**
 * Returns the stack trace for doAssert()
 */
private static String getStackTrace() {

    try {
        Exception e = new Exception();

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

        e1.printStackTrace(pw);

        return os.toString();
    }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:19,代码来源:Trace.java


示例14: ScaledRAFile

import org.hsqldb.lib.HsqlByteArrayOutputStream; //导入依赖的package包/类
ScaledRAFile(Database database, String name, boolean readonly,
             boolean extendLengthToBlock)
             throws FileNotFoundException, IOException {

    this.database     = database;
    this.fileName     = name;
    this.readOnly     = readonly;
    this.extendLength = extendLengthToBlock;

    String accessMode = readonly ? "r"
                                 : extendLength ? "rw"
                                                : "rws";

    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();
}
 
开发者ID:RabadanLab,项目名称:Pegasus,代码行数:25,代码来源:ScaledRAFile.java


示例15: allocateBlobSegments

import org.hsqldb.lib.HsqlByteArrayOutputStream; //导入依赖的package包/类
private void allocateBlobSegments(ResultLob result,
                                  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();
        Result actionResult =
            database.lobManager.setBytes(result.getLobID(), currentOffset,
                                         byteArray, byteArrayOS.size());

        currentOffset += byteArrayOS.size();

        if (byteArrayOS.size() < bufferLength) {
            return;
        }
    }
}
 
开发者ID:RabadanLab,项目名称:Pegasus,代码行数:26,代码来源:SessionData.java


示例16: allocateBlobSegments

import org.hsqldb.lib.HsqlByteArrayOutputStream; //导入依赖的package包/类
private void allocateBlobSegments(ResultLob result,
                                  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);

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

        byte[] byteArray = byteArrayOS.getBuffer();
        Result actionResult =
            database.lobManager.setBytes(result.getLobID(), currentOffset,
                                         byteArray, byteArrayOS.size());
        // FIXME: actionResult not used anymore!?

        currentOffset += byteArrayOS.size();

        if (byteArrayOS.size() < bufferLength) {
            return;
        }
    }
}
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:31,代码来源:SessionData.java


示例17: ScriptWriterEncode

import org.hsqldb.lib.HsqlByteArrayOutputStream; //导入依赖的package包/类
public ScriptWriterEncode(Database db, String file, Crypto crypto) {

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

        this.crypto = crypto;
        byteOut     = new HsqlByteArrayOutputStream();
        isCrypt     = true;
    }
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:9,代码来源:ScriptWriterEncode.java


示例18: setBinaryStream

import org.hsqldb.lib.HsqlByteArrayOutputStream; //导入依赖的package包/类
/**
 * Sets the designated parameter to the given input stream, which will have
 * the specified number of bytes.
 * When a very large binary value is input to a <code>LONGVARBINARY</code>
 * parameter, it may be more practical to send it via a
 * <code>java.io.InputStream</code> object. The data will be read from the
 * stream as needed until end-of-file is reached.
 *
 * <P><B>Note:</B> This stream object can either be a standard
 * Java stream object or your own subclass that implements the
 * standard interface.
 *
 * @param parameterIndex the first parameter is 1, the second is 2, ...
 * @param x the java input stream which contains the binary parameter value
 * @param length the number of bytes in the stream
 * @exception SQLException if a database access error occurs or
 * this method is called on a closed <code>PreparedStatement</code>
 * @since JDK 1.6 b86, HSQLDB 1.9.0
 */
public synchronized void setBinaryStream(int parameterIndex,
        java.io.InputStream x, long length) throws SQLException {

    if (length < 0) {
        throw Util.sqlException(ErrorCode.JDBC_INVALID_ARGUMENT,
                                "length: " + length);
    }

    if (x instanceof BlobInputStream) {
        throw Util.sqlException(ErrorCode.JDBC_INVALID_ARGUMENT,
                                "invalid InputStream");
    }
    checkSetParameterIndex(parameterIndex, true);

    if (parameterTypes[parameterIndex - 1].typeCode == Types.SQL_BLOB) {
        streamLengths[parameterIndex - 1] = length;

        setParameter(parameterIndex, x);

        return;
    }

    try {
        if (length > Integer.MAX_VALUE) {
            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());
    }
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:58,代码来源:JDBCPreparedStatement.java


示例19: TextFileReader

import org.hsqldb.lib.HsqlByteArrayOutputStream; //导入依赖的package包/类
TextFileReader(RandomAccessInterface dataFile,
               TextFileSettings textFileSettings, RowInputInterface rowIn,
               boolean isReadOnly) {

    this.dataFile         = dataFile;
    this.textFileSettings = textFileSettings;
    this.rowIn            = rowIn;
    this.isReadOnly       = isReadOnly;
    this.buffer           = new HsqlByteArrayOutputStream(128);
}
 
开发者ID:Julien35,项目名称:dev-courses,代码行数:11,代码来源:TextFileReader.java


示例20: allocateBlobSegments

import org.hsqldb.lib.HsqlByteArrayOutputStream; //导入依赖的package包/类
private void allocateBlobSegments(ResultLob result,
                                  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);

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

        byte[] byteArray = byteArrayOS.getBuffer();
        Result actionResult =
            database.lobManager.setBytes(result.getLobID(), currentOffset,
                                         byteArray, byteArrayOS.size());

        currentOffset += byteArrayOS.size();

        if (byteArrayOS.size() < bufferLength) {
            return;
        }
    }
}
 
开发者ID:Julien35,项目名称:dev-courses,代码行数:30,代码来源:SessionData.java



注:本文中的org.hsqldb.lib.HsqlByteArrayOutputStream类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ClassNameComparator类代码示例发布时间:2022-05-23
下一篇:
Java ServiceDescriptor类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap