Package org.jgroups.util

Examples of org.jgroups.util.ByteArrayDataOutputStream.buffer()


            if(msg.getSrc() == null)
                msg.setSrc(local_addr);
            ByteArrayDataOutputStream out=new ByteArrayDataOutputStream(128);
            msg.writeTo(out);
            for(int i=bind_port; i <= bind_port+port_range; i++) {
                DatagramPacket packet=new DatagramPacket(out.buffer(), 0, out.position(), dest_addr, i);
                sock.send(packet);
            }
        }
        catch(Exception ex) {
            log.error("failed sending discovery request", ex);
View Full Code Here


            num_msgs_sent++;
            num_bytes_sent+=dos.position();
        }
        List<RouterStub> stubs = stubManager.getStubs();
        if(dest == null)
            tunnel_policy.sendToAllMembers(stubs, group, dos.buffer(), 0, dos.position());
        else
            tunnel_policy.sendToSingleMember(stubs, group, dest, dos.buffer(), 0, dos.position());
    }

View Full Code Here

        }
        List<RouterStub> stubs = stubManager.getStubs();
        if(dest == null)
            tunnel_policy.sendToAllMembers(stubs, group, dos.buffer(), 0, dos.position());
        else
            tunnel_policy.sendToSingleMember(stubs, group, dest, dos.buffer(), 0, dos.position());
    }


    public void sendMulticast(AsciiString cluster_name, byte[] data, int offset, int length) throws Exception {
        throw new UnsupportedOperationException("sendMulticast() should not get called on TUNNEL");
View Full Code Here

            num_msgs_sent++;
            num_bytes_sent+=dos.position();
        }
        List<RouterStub> stubs = stubManager.getStubs();
        if(dest == null)
            tunnel_policy.sendToAllMembers(stubs, group, dos.buffer(), 0, dos.position());
        else
            tunnel_policy.sendToSingleMember(stubs, group, dest, dos.buffer(), 0, dos.position());
    }

View Full Code Here

        }
        List<RouterStub> stubs = stubManager.getStubs();
        if(dest == null)
            tunnel_policy.sendToAllMembers(stubs, group, dos.buffer(), 0, dos.position());
        else
            tunnel_policy.sendToSingleMember(stubs, group, dest, dos.buffer(), 0, dos.position());
    }


    public void sendMulticast(AsciiString cluster_name, byte[] data, int offset, int length) throws Exception {
        throw new UnsupportedOperationException("sendMulticast() should not get called on TUNNEL");
View Full Code Here

    public void testByte() throws IOException {
        ByteArrayDataOutputStream out=new ByteArrayDataOutputStream(Byte.MAX_VALUE * 2);
        for(short i=Byte.MIN_VALUE; i <= Byte.MAX_VALUE; i++)
            out.writeByte(i);

        ByteArrayDataInputStream in=new ByteArrayDataInputStream(out.buffer());
        for(short i=Byte.MIN_VALUE; i <= Byte.MAX_VALUE; i++) {
            byte read=in.readByte();
            assert i == read;
        }
    }
View Full Code Here

    public void testUnsignedByte() throws IOException {
        ByteArrayDataOutputStream out=new ByteArrayDataOutputStream(20);
        byte[] bytes={-100, -50, 0, 1, 100, 127};
        for(byte b: bytes)
            out.writeByte(b);
        ByteArrayDataInputStream in=new ByteArrayDataInputStream(out.buffer());
        for(byte b: bytes) {
            int tmp=in.readUnsignedByte();
            assert tmp == (b & 0xff);
        }
    }
View Full Code Here

    public void testBoolean() throws Exception {
        ByteArrayDataOutputStream out=new ByteArrayDataOutputStream(2);
        out.writeBoolean(true);
        out.writeBoolean(false);
        ByteArrayDataInputStream in=new ByteArrayDataInputStream(out.buffer());
        assert in.readBoolean();
        assert !in.readBoolean();
    }

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

    public void testShort() throws IOException {
        ByteArrayDataOutputStream out=new ByteArrayDataOutputStream(Short.MAX_VALUE * 4 + 10);
        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;
        }
    }
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;
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.