Code example for DataInputStream

Methods: readreadBooleanreadShort

        this.marshallerFactory = marshallerFactory;
    public void processMessage(final ChannelAssociation channelAssociation, final InputStream inputStream) throws IOException {
        final DataInputStream input = new DataInputStream(inputStream);
        // read the invocation id 
        final short invocationId = input.readShort();
        // read the transaction id length 
        final int transactionIDBytesLength = PackedInteger.readPackedInteger(input);
        // read the transaction id bytes 
        final byte[] transactionIDBytes = new byte[transactionIDBytesLength];;
        final TransactionID transactionID = TransactionID.createTransactionID(transactionIDBytes);
        // if it's a commit request, the read the additional "bit" which indicates whether it's a one-phase 
        // commit request 
        boolean onePhaseCommit = false;
        if (this.txRequestType == TransactionRequestType.COMMIT) {
            onePhaseCommit = input.readBoolean();
        // start processing 
        if (transactionID instanceof UserTransactionID) {
            // handle UserTransaction