Package org.jgroups.util

Examples of org.jgroups.util.ByteArrayDataInputStream.readShort()


        for(int i=Short.MIN_VALUE; i <= Short.MAX_VALUE; i++)
            out.writeShort(i);

        ByteArrayDataInputStream in=new ByteArrayDataInputStream(out.buffer());
        for(int i=Short.MIN_VALUE; i <= Short.MAX_VALUE; i++) {
            short read=in.readShort();
            assert i == read;
        }
    }

    public void testUnsignedShort() throws IOException {
View Full Code Here


    public void testUnsignedShort() throws IOException {
        ByteArrayDataOutputStream out=new ByteArrayDataOutputStream(20);
        out.writeShort(-22);
        out.writeShort(22);
        ByteArrayDataInputStream in=new ByteArrayDataInputStream(out.buffer());
        short num=in.readShort();
        assert num == -22;
        num=in.readShort();
        assert num == 22;

        in.position(0);
View Full Code Here

        out.writeShort(-22);
        out.writeShort(22);
        ByteArrayDataInputStream in=new ByteArrayDataInputStream(out.buffer());
        short num=in.readShort();
        assert num == -22;
        num=in.readShort();
        assert num == 22;

        in.position(0);
        int val=in.readUnsignedShort();
        assert val == 65514;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.