当前位置: 首页>>代码示例>>Java>>正文


Java HsqlByteArrayOutputStream类代码示例

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


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


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