Package dijjer.util

Examples of dijjer.util.Buffer


    m1.set("boolean", true);
    m1.set("byte", (byte) 15);
    m1.set("short", (short) 32);
    m1.set("int", (int) 64);
    m1.set("string", "gnirts");
    Buffer b = new Buffer(new byte[10]);
    m1.set("buffer", b);
    LinkedList ll = new LinkedList();
    ll.add("one");
    ll.add("two");
    ll.add("three");
View Full Code Here


    return new byte[] {(byte)p, (byte)p};
  }
 
  public void testAll() {
    PartiallyReceivedBlock prb = new PartiallyReceivedBlock(2, 2);
    prb.addPacket(0, new Buffer(makePacket(1)));
    LinkedList pr = prb.addListener(new PartiallyReceivedBlock.PacketReceivedListener() {
      public void packetReceived(int packetNo) {
        System.out.println("Received packet "+packetNo);
      }
     
     
      public void receiveAborted(int reason, String description) {
        System.out.println("Receive aborted - "+reason+" "+description);
      }
    });
    prb.addPacket(1, new Buffer(makePacket(2)));
    byte[] block = prb.getBlock();
    for (int x=0; x<block.length; x++) {
      System.out.print(block[x]);
    }
    System.out.println();
View Full Code Here

 
  public Buffer getPacket(int x) {
    if (_aborted) {
      throw new RuntimeException("PRB is aborted");
    }
    return new Buffer(_data, x * _packetSize, _packetSize);
  }
View Full Code Here

      if ((m1 != null) && (m1.getSpec().equals(DMT.packetTransmit))) {
        consecutiveMissingPacketReports = 0;
        // packetTransmit received
        int packetNo = m1.getInt(DMT.PACKET_NO);
        BitArray sent = (BitArray) m1.getObject(DMT.SENT);
        Buffer data = (Buffer) m1.getObject(DMT.DATA);
        _prb.addPacket(packetNo, data);
        // Remove it from rrmp if its in there
        _recentlyReportedMissingPackets.remove(new Integer(packetNo));
        // Skip checks except for 1 out of 16 packets until we get to the end
        if ((_prb.numReceived() < (_prb.getNumPackets() - 16))
View Full Code Here

              break;
            }
            offset += r;
          }
        }
        _prb.addPacket(packet, new Buffer(ret));
      }
    } catch (IOException e) {
      _prb.abort(RetrievalException.IO_ERROR, e.getMessage());
      throw e;
    }
View Full Code Here

    written[3] = new Integer(r.nextInt());
    written[4] = new Long(r.nextLong());
    written[5] = Long.toString(r.nextLong());
    byte[] buf = new byte[r.nextInt() % 100];
    r.nextBytes(buf);
    written[6] = new Buffer(buf);
    written[7] = new VeryLongInteger(r.nextLong(), r.nextLong());
    written[8] = new Peer(InetAddress.getByName("google.com"), 1234);
    BitArray ba = new BitArray(r.nextInt() % 100);
    for (int x=0; x<ba.getSize(); x++) {
      ba.setBit(x, r.nextBoolean());
View Full Code Here

TOP

Related Classes of dijjer.util.Buffer

Copyright © 2018 www.massapicom. 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.