Java 8 DataInputStream - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 DataInputStream class.

This code example shows how to use the following methods: read, readBoolean, readShort
        this.marshallerFactory = marshallerFactory;
    } 
 
    @Override 
    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];
        input.read(transactionIDBytes);
        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();
        } 

9
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: readByte, readInt, readLong
        bb.putInt(255);
        bb.put((byte) -3);
        bb.putLong(42L);
        bb.clear();
 
        DataInputStream in = new DataInputStream(ByteBufferUtil.inputStream(bb));
        assert in.readInt() == 255;
        assert in.readByte() == (byte)-3;
        assert in.readLong() == 42L;
    } 
 
    @Test 
    public void testIntBytesConversions() 
    { 
        // positive, negative, 1 and 2 byte cases, including a few edges that would foul things up unless you're careful 
        // about masking away sign extension. 
        int[] ints = new int[]
        { 
            -20, -127, -128, 0, 1, 127, 128, 65534, 65535, -65534, -65535 
        }; 
Full Snippet Info
8
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: readInt, readShort, readUTF
        this.marshallerFactory = marshallerFactory;
    } 
 
    @Override 
    public void processMessage(ChannelAssociation channelAssociation, InputStream inputStream) throws IOException {
        final DataInputStream input = new DataInputStream(inputStream);
        // read the invocation id 
        final short invocationId = input.readShort();
        final String txParentNodeName = input.readUTF();
        final int recoveryFlags = input.readInt();
        executorService.submit(new TxRecoveryTask(channelAssociation, invocationId, txParentNodeName, recoveryFlags));
    } 
 
    private final class TxRecoveryTask implements Runnable {
 
        private final String txParentNodeName;
        private final short invocationId;
        private final ChannelAssociation channelAssociation;
        private final int recoveryFlags;
 
Full Snippet Info
8
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: readBoolean, readInt
		plugMatrix.writeData(data);
	} 
 
	@Override 
	public void readData(DataInputStream data) throws IOException {
		hasGate = data.readBoolean();
		gateIconIndex = data.readInt();
		pipeConnectionMatrix.readData(data);
		textureMatrix.readData(data);
		wireMatrix.readData(data);
		facadeMatrix.readData(data);
		plugMatrix.readData(data);
	} 
} 
Full Snippet Info
8
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods:
    tbw.setValue(12345);
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    DataOutput dout = new DataOutputStream(baos);
    tbw.write(dout);
    ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
    DataInput din = new DataInputStream(bais);
    TypedBytesWritable readTbw = new TypedBytesWritable();
    readTbw.readFields(din);
    assertEquals(tbw, readTbw);
  } 
 
} 
Full Snippet Info
8
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE

Related Java 8 DataInputStream Questions & Answers:

See Code Examples for Java 8 DataInputStream Methods: