Examples of ByteArrayDataOutputStream


Examples of org.jboss.classfilewriter.util.ByteArrayDataOutputStream

    public byte[] toBytecode() {
        // TODO: throw illegal state exception if the class file is modified after writing
        if (bytecode == null) {
            try {
                ByteArrayDataOutputStream out = new ByteArrayDataOutputStream();
                write(out);
                bytecode = out.getBytes();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return bytecode;
View Full Code Here

Examples of org.jboss.classfilewriter.util.ByteArrayDataOutputStream

    public byte[] toBytecode() {
        // TODO: throw illegal state exception if the class file is modified after writing
        if (bytecode == null) {
            try {
                ByteArrayDataOutputStream out = new ByteArrayDataOutputStream();
                write(out);
                bytecode = out.getBytes();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return bytecode;
View Full Code Here

Examples of org.jboss.classfilewriter.util.ByteArrayDataOutputStream

    public byte[] toBytecode() {
        // TODO: throw illegal state exception if the class file is modified after writing
        if (bytecode == null) {
            try {
                ByteArrayDataOutputStream out = new ByteArrayDataOutputStream();
                write(out);
                bytecode = out.getBytes();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return bytecode;
View Full Code Here

Examples of org.jboss.classfilewriter.util.ByteArrayDataOutputStream

    public byte[] toBytecode() {
        // TODO: throw illegal state exception if the class file is modified after writing
        if (bytecode == null) {
            try {
                ByteArrayDataOutputStream out = new ByteArrayDataOutputStream();
                write(out);
                bytecode = out.getBytes();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return bytecode;
View Full Code Here

Examples of org.jgroups.util.ByteArrayDataOutputStream

    @Override
    protected void sendMcastDiscoveryRequest(Message msg) {
        try {
            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

Examples of org.jgroups.util.ByteArrayDataOutputStream

        TpHeader hdr=(TpHeader)msg.getHeader(this.id);
        if(hdr == null)
            throw new Exception("message " + msg + " doesn't have a transport header, cannot route it");
        String group=cluster_name != null? cluster_name.toString() : null;

        ByteArrayDataOutputStream dos=new ByteArrayDataOutputStream((int)(msg.size() + 50));
        writeMessage(msg, dos, dest == null);

        if(stats) {
            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

Examples of org.jgroups.util.ByteArrayDataOutputStream

        TpHeader hdr=(TpHeader)msg.getHeader(this.id);
        if(hdr == null)
            throw new Exception("message " + msg + " doesn't have a transport header, cannot route it");
        String group=cluster_name != null? cluster_name.toString() : null;

        ByteArrayDataOutputStream dos=new ByteArrayDataOutputStream((int)(msg.size() + 50));
        writeMessage(msg, dos, dest == null);

        if(stats) {
            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

Examples of org.jgroups.util.ByteArrayDataOutputStream

        return 100.0* (1.0 - (new_length / (double)old_length));
    }

    private static Buffer marshal(Message msg) throws Exception {
        ByteArrayDataOutputStream dos=new ByteArrayDataOutputStream((int)(msg.size() + 50));
        Address dest=msg.getDest();
        boolean multicast=dest == null;
        writeMessage(msg, dos, multicast);
        return dos.getBuffer();
    }
View Full Code Here

Examples of org.jgroups.util.ByteArrayDataOutputStream

            assert ex instanceof IndexOutOfBoundsException;
        }
    }

    public void testExpanding() throws IOException {
        ByteArrayDataOutputStream out=new ByteArrayDataOutputStream(1);
        for(int i='A'; i < 'A' + 20; i++)
            out.write(i);
        assert out.position() == 20;

        byte[] buffer=new byte[20];
        for(int i=0; i < 5; i++)
            out.write(buffer);
        assert out.position() == 120;
    }
View Full Code Here

Examples of org.jgroups.util.ByteArrayDataOutputStream

            out.write(buffer);
        assert out.position() == 120;
    }

    public void testExpanding2() {
        ByteArrayDataOutputStream out=new ByteArrayDataOutputStream(1);
        out.write(new byte[]{'b', 'e', 'l', 'a'});

        out=new ByteArrayDataOutputStream(1);
        out.writeBoolean(true);
        out.writeBoolean(false);

        out=new ByteArrayDataOutputStream(1);
        out.writeShort(22);
        out.writeShort(23);

        out=new ByteArrayDataOutputStream(1);
        out.writeInt(23);
        out.writeInt(24);
    }
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.