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


Java DataOutputStream类代码示例

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


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

示例1: alertClient

import org.hsqldb.lib.DataOutputStream; //导入依赖的package包/类
static void alertClient(int severity, String message,
String sqlStateCode, DataOutputStream hOutStream) throws IOException {
    if (sqlStateCode == null) {
        sqlStateCode = "XX000";
        // This default code means INTERNAL ERROR
    }
    if (!odbcSeverityMap.containsKey(severity)) {
        throw new IllegalArgumentException(
            "Unknown severity value (" + severity + ')');
    }
    OdbcPacketOutputStream alertPacket =
        OdbcPacketOutputStream.newOdbcPacketOutputStream();
    alertPacket.write("S" + odbcSeverityMap.get(severity));
    if (severity < ODBC_SEVERITY_NOTICE) {
        alertPacket.write("C" + sqlStateCode);
    }
    alertPacket.write("M" + message);
    alertPacket.writeByte(0);
    alertPacket.xmit((severity < ODBC_SEVERITY_NOTICE) ? 'E' : 'N',
            hOutStream);
    alertPacket.close();
}
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:23,代码来源:OdbcUtil.java

示例2: write

import org.hsqldb.lib.DataOutputStream; //导入依赖的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

示例3: writeCreate

import org.hsqldb.lib.DataOutputStream; //导入依赖的package包/类
private void writeCreate(SessionInterface session,
                         DataOutputStream dataOut) throws IOException {

    dataOut.writeByte(mode);
    dataOut.writeInt(databaseID);
    dataOut.writeLong(sessionID);
    dataOut.writeLong(lobID);
    dataOut.writeInt(subType);
    dataOut.writeLong(blockOffset);
    dataOut.writeLong(blockLength);

    switch (subType) {

        case LobResultTypes.REQUEST_CREATE_BYTES :
            dataOut.write(stream, blockLength);
            break;

        case LobResultTypes.REQUEST_CREATE_CHARS :
            dataOut.write(reader, blockLength);
            break;
    }
}
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:23,代码来源:ResultLob.java

示例4: xmit

import org.hsqldb.lib.DataOutputStream; //导入依赖的package包/类
/**
 * @return packet size (which does not count the type byte).
 */
synchronized int xmit(char packetType,
                      DataOutputStream destinationStream)
                      throws IOException {

    byte[] ba = byteArrayOutputStream.toByteArray();

    ba[0] = (byte) (ba.length >> 24);
    ba[1] = (byte) (ba.length >> 16);
    ba[2] = (byte) (ba.length >> 8);
    ba[3] = (byte) ba.length;

    reset();
    destinationStream.writeByte(packetType);
    destinationStream.write(ba);
    destinationStream.flush();

    return ba.length;
}
 
开发者ID:Julien35,项目名称:dev-courses,代码行数:22,代码来源:OdbcPacketOutputStream.java

示例5: openConnection

import org.hsqldb.lib.DataOutputStream; //导入依赖的package包/类
protected void openConnection(String host, int port, boolean isTLS) {

        try {
            socket = HsqlSocketFactory.getInstance(isTLS).createSocket(host,
                                                   port);

            socket.setTcpNoDelay(true);

            dataOutput = new DataOutputStream(socket.getOutputStream());
            dataInput = new DataInputStream(
                new BufferedInputStream(socket.getInputStream()));

            handshake();
        } catch (Exception e) {

            // The details from "e" should not be thrown away here.  This is
            // very useful info for end users to diagnose the runtime problem.
            throw new HsqlException(e, Error.getStateString(ErrorCode.X_08001),
                                    -ErrorCode.X_08001);
        }
    }
 
开发者ID:RabadanLab,项目名称:Pegasus,代码行数:22,代码来源:ClientConnection.java

示例6: writeParam

import org.hsqldb.lib.DataOutputStream; //导入依赖的package包/类
static void writeParam(
String key, String val, DataOutputStream hOutStream) throws IOException {
    OdbcPacketOutputStream alertPacket =
        OdbcPacketOutputStream.newOdbcPacketOutputStream();
    alertPacket.write(key);
    alertPacket.write(val);
    alertPacket.xmit('S', hOutStream);
    alertPacket.close();
}
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:10,代码来源:OdbcUtil.java

示例7: write

import org.hsqldb.lib.DataOutputStream; //导入依赖的package包/类
public void write(SessionInterface session, DataOutputStream dataOut,
                  RowOutputInterface rowOut) throws IOException {

    writeBody(session, dataOut);
    dataOut.writeByte(ResultConstants.NONE);
    dataOut.flush();
}
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:8,代码来源:ResultLob.java

示例8: openConnection

import org.hsqldb.lib.DataOutputStream; //导入依赖的package包/类
protected void openConnection(String host, int port, boolean isTLS) {

        try {
            if (isTLSWrapper) {
                socket =
                    HsqlSocketFactory.getInstance(false).createSocket(host,
                                                  port);
            }

            socket = HsqlSocketFactory.getInstance(isTLS).createSocket(socket,
                                                   host, port);

            socket.setTcpNoDelay(true);

            dataOutput = new DataOutputStream(socket.getOutputStream());
            dataInput = new DataInputStream(
                new BufferedInputStream(socket.getInputStream()));

            handshake();
        } catch (Exception e) {

            // The details from "e" should not be thrown away here.  This is
            // very useful info for end users to diagnose the runtime problem.
            throw new HsqlException(e, Error.getStateString(ErrorCode.X_08001),
                                    -ErrorCode.X_08001);
        }
    }
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:28,代码来源:ClientConnection.java

示例9: writeSingleColumnResult

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

        DataOutputStream dataOutput = new DataOutputStream(fileStreamOut);

        rowOut.reset();
        r.write(dataOutput, rowOut);
        dataOutput.flush();
    }
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:9,代码来源:ScriptWriterBinary.java

示例10: write

import org.hsqldb.lib.DataOutputStream; //导入依赖的package包/类
public void write(DataOutputStream dataOut,
                  RowOutputInterface rowOut)
                  throws IOException {

    writeBody(dataOut);
    dataOut.writeByte(ResultConstants.NONE);
    dataOut.flush();
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:9,代码来源:ResultLob.java

示例11: init

import org.hsqldb.lib.DataOutputStream; //导入依赖的package包/类
/**
 * Initializes this connection.
 * <p>
 * Will return (not throw) if fail to initialize the connection.
 * </p>
 */
private void init() {

    runnerThread = Thread.currentThread();
    keepAlive    = true;

    try {
        socket.setTcpNoDelay(true);

        dataInput = new DataInputStream(
            new BufferedInputStream(socket.getInputStream()));
        dataOutput = new DataOutputStream(socket.getOutputStream());

        int firstInt = handshake();

        switch (streamProtocol) {

            case HSQL_STREAM_PROTOCOL :
                if (firstInt
                        != ClientConnection
                            .NETWORK_COMPATIBILITY_VERSION_INT) {
                    if (firstInt == -1900000) {
                        firstInt = -2000000;
                    }

                    String verString =
                        ClientConnection.toNetCompVersionString(firstInt);

                    throw Error.error(
                        null, ErrorCode.SERVER_VERSIONS_INCOMPATIBLE, 0,
                        new String[] {
                        verString, HsqlDatabaseProperties.THIS_VERSION
                    });
                }

                int msgType = dataInput.readByte();

                receiveResult(msgType);
                break;

            case ODBC_STREAM_PROTOCOL :
                odbcConnect(firstInt);
                break;

            default :

                // Protocol detection failures should already have been
                // handled.
                keepAlive = false;
        }
    } catch (Exception e) {

        // Only "unexpected" failures are caught here.
        // Expected failures will have been handled (by sending feedback
        // to user-- with an output Result for normal protocols), then
        // continuing.
        StringBuffer sb = new StringBuffer(mThread
                                           + ":Failed to connect client.");

        if (user != null) {
            sb.append("  User '" + user + "'.");
        }

        server.printWithThread(sb.toString() + "  Stack trace follows.");
        server.printStackTrace(e);
    }
}
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:73,代码来源:ServerConnection.java

示例12: writeCreateByteSegments

import org.hsqldb.lib.DataOutputStream; //导入依赖的package包/类
private void writeCreateByteSegments(SessionInterface session,
                                     DataOutputStream dataOut)
                                     throws IOException {

    //
    int  bufferLength  = session.getStreamBlockSize();
    long currentOffset = blockOffset;

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

示例13: writeCreateCharSegments

import org.hsqldb.lib.DataOutputStream; //导入依赖的package包/类
private void writeCreateCharSegments(SessionInterface session,
                                     DataOutputStream dataOut)
                                     throws IOException {

    //
    int  bufferLength  = session.getStreamBlockSize();
    long currentOffset = blockOffset;

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

示例14: writeBody

import org.hsqldb.lib.DataOutputStream; //导入依赖的package包/类
public void writeBody(DataOutputStream dataOut)
throws IOException {

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

    switch (subType) {

        case LobResultTypes.REQUEST_CREATE_BYTES :
            dataOut.writeLong(blockOffset);
            dataOut.writeLong(blockLength);
            dataOut.write(stream, blockLength);
            break;

        case LobResultTypes.REQUEST_CREATE_CHARS :
            dataOut.writeLong(blockOffset);
            dataOut.writeLong(blockLength);
            dataOut.write(reader, blockLength);
            break;

        case LobResultTypes.REQUEST_SET_BYTES :
        case LobResultTypes.REQUEST_GET_BYTE_PATTERN_POSITION :
            dataOut.writeLong(blockOffset);
            dataOut.writeLong(blockLength);
            dataOut.write(byteBlock);
            break;

        case LobResultTypes.REQUEST_SET_CHARS :
        case LobResultTypes.REQUEST_GET_CHAR_PATTERN_POSITION :
            dataOut.writeLong(blockOffset);
            dataOut.writeLong(blockLength);
            dataOut.writeChars(charBlock);
            break;

        case LobResultTypes.REQUEST_GET_LOB :

        //
        case LobResultTypes.REQUEST_GET_BYTES :
        case LobResultTypes.REQUEST_GET_CHARS :
            dataOut.writeLong(blockOffset);
            dataOut.writeLong(blockLength);
            break;

        case LobResultTypes.REQUEST_GET_LENGTH :
        case LobResultTypes.REQUEST_TRUNCATE :
            dataOut.writeLong(blockOffset);
            break;

        case LobResultTypes.RESPONSE_GET_BYTES :
            dataOut.writeLong(blockOffset);
            dataOut.writeLong(blockLength);
            dataOut.write(byteBlock);
            break;

        case LobResultTypes.RESPONSE_GET_CHARS :
            dataOut.writeLong(blockOffset);
            dataOut.writeLong(blockLength);
            dataOut.writeChars(charBlock);
            break;

        case LobResultTypes.RESPONSE_SET :
        case LobResultTypes.RESPONSE_CREATE_BYTES :
        case LobResultTypes.RESPONSE_CREATE_CHARS :
        case LobResultTypes.RESPONSE_TRUNCATE :
            dataOut.writeLong(blockLength);
            break;

        case LobResultTypes.RESPONSE_GET_BYTE_PATTERN_POSITION :
        case LobResultTypes.RESPONSE_GET_CHAR_PATTERN_POSITION :
            dataOut.writeLong(blockOffset);
            break;

        default :
            throw Error.runtimeError(ErrorCode.U_S0500, "ResultLob");
    }
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:80,代码来源:ResultLob.java

示例15: init

import org.hsqldb.lib.DataOutputStream; //导入依赖的package包/类
/**
 * Initializes this connection.
 * <p>
 * Will return (not throw) if fail to initialize the connection.
 * </p>
 */
private void init() {

    runnerThread = Thread.currentThread();
    keepAlive    = true;

    try {
        socket.setTcpNoDelay(true);

        dataInput = new DataInputStream(
            new BufferedInputStream(socket.getInputStream()));
        dataOutput = new DataOutputStream(socket.getOutputStream());

        int firstInt = handshake();

        switch (streamProtocol) {

            case HSQL_STREAM_PROTOCOL :
                if (firstInt
                        != ClientConnection
                            .NETWORK_COMPATIBILITY_VERSION_INT) {
                    if (firstInt == -1900000) {
                        firstInt = -2000000;
                    }

                    String verString =
                        ClientConnection.toNetCompVersionString(firstInt);

                    throw Error.error(
                        null, ErrorCode.SERVER_VERSIONS_INCOMPATIBLE, 0,
                        new String[] {
                        verString, HsqlDatabaseProperties.THIS_VERSION
                    });
                }

                Result resultIn = Result.newResult(dataInput, rowIn);

                resultIn.readAdditionalResults(session, dataInput, rowIn);

                Result resultOut;

                resultOut = setDatabase(resultIn);

                resultOut.write(session, dataOutput, rowOut);
                break;

            case ODBC_STREAM_PROTOCOL :
                odbcConnect(firstInt);
                break;

            default :

                // Protocol detection failures should already have been
                // handled.
                keepAlive = false;
        }
    } catch (Exception e) {

        // Only "unexpected" failures are caught here.
        // Expected failures will have been handled (by sending feedback
        // to user-- with an output Result for normal protocols), then
        // continuing.
        StringBuffer sb = new StringBuffer(mThread
                                           + ":Failed to connect client.");

        if (user != null) {
            sb.append("  User '" + user + "'.");
        }

        server.printWithThread(sb.toString() + "  Stack trace follows.");
        server.printStackTrace(e);
    }
}
 
开发者ID:Julien35,项目名称:dev-courses,代码行数:79,代码来源:ServerConnection.java


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