Package org.jgroups.util

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


        byte[] buf={'h', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd'};
        ByteArrayDataInputStream in=new ByteArrayDataInputStream(buf);
        assert in.position() == 0;
        int skipped=in.skipBytes(6);
        assert skipped == 6;
        assert in.position() == 6;

        skipped=in.skipBytes(0);
        assert skipped == 0;
        assert in.position() == 6;
View Full Code Here


        assert skipped == 6;
        assert in.position() == 6;

        skipped=in.skipBytes(0);
        assert skipped == 0;
        assert in.position() == 6;

        skipped=in.skipBytes(-1);
        assert skipped == 0;
        assert in.position() == 6;
View Full Code Here

        assert skipped == 0;
        assert in.position() == 6;

        skipped=in.skipBytes(-1);
        assert skipped == 0;
        assert in.position() == 6;

        skipped=in.skipBytes(5);
        assert skipped == 5;
        assert in.position() == 11;
View Full Code Here

        assert skipped == 0;
        assert in.position() == 6;

        skipped=in.skipBytes(5);
        assert skipped == 5;
        assert in.position() == 11;

        in.position(6);
        skipped=in.skipBytes(20);
        assert skipped == 5;
        assert in.position() == 11;
View Full Code Here

        skipped=in.skipBytes(5);
        assert skipped == 5;
        assert in.position() == 11;

        in.position(6);
        skipped=in.skipBytes(20);
        assert skipped == 5;
        assert in.position() == 11;
    }
View Full Code Here

        assert in.position() == 11;

        in.position(6);
        skipped=in.skipBytes(20);
        assert skipped == 5;
        assert in.position() == 11;
    }

    public void testRead() {
        byte[] buf={'b', 'e', 'l', 'a'};
        ByteArrayDataInputStream  in=new ByteArrayDataInputStream(buf);
View Full Code Here

        byte[] name="Bela".getBytes();
        ByteArrayDataInputStream  in=new ByteArrayDataInputStream(name);
        byte[] buf=new byte[10];
        int read=in.read(buf, 0, buf.length);
        assert read == 4;
        assert in.position() == 4;

        in.position(0);
        try {
            in.readFully(buf, 0, buf.length);
            assert false : "readFully() should have thrown an EOFException";
View Full Code Here

        byte[] buf=new byte[10];
        int read=in.read(buf, 0, buf.length);
        assert read == 4;
        assert in.position() == 4;

        in.position(0);
        try {
            in.readFully(buf, 0, buf.length);
            assert false : "readFully() should have thrown an EOFException";
        }
        catch(Exception eof_ex) {
View Full Code Here

        short num=in.readShort();
        assert num == -22;
        num=in.readShort();
        assert num == 22;

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

    public void testLimit() {
        byte[] buf=new byte[100];
        buf[0]='B'; buf[1]='e'; buf[2]='l'; buf[3]='a';
        ByteArrayDataInputStream in=new ByteArrayDataInputStream(buf);
        assert in.position() == 0;
        assert in.limit() == buf.length;
        assert in.capacity() == buf.length;

        in=new ByteArrayDataInputStream(buf, 0, 4);
        assert in.position() == 0;
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.