Package freenet.support.io

Examples of freenet.support.io.ByteArrayRandomAccessBuffer


    }

    @Test
    public void testClose() throws IOException, GeneralSecurityException {
        byte[] bytes = new byte[100];
        ByteArrayRandomAccessBuffer barat = new ByteArrayRandomAccessBuffer(bytes);
        EncryptedRandomAccessBuffer erat = new EncryptedRandomAccessBuffer(types[0], barat, secret, true);
        erat.close();
        erat.close();
    }
View Full Code Here


    }

    @Test
    public void testClosePread() throws IOException, GeneralSecurityException {
        byte[] bytes = new byte[100];
        ByteArrayRandomAccessBuffer barat = new ByteArrayRandomAccessBuffer(bytes);
        EncryptedRandomAccessBuffer erat = new EncryptedRandomAccessBuffer(types[0], barat, secret, true);
        erat.close();
        byte[] result = new byte[20];
        thrown.expect(IOException.class);
        thrown.expectMessage("This RandomAccessBuffer has already been closed. It can no longer"
View Full Code Here

    }

    @Test
    public void testClosePwrite() throws IOException, GeneralSecurityException {
        byte[] bytes = new byte[100];
        ByteArrayRandomAccessBuffer barat = new ByteArrayRandomAccessBuffer(bytes);
        EncryptedRandomAccessBuffer erat = new EncryptedRandomAccessBuffer(types[0], barat, secret, true);
        erat.close();
        byte[] result = new byte[20];
        thrown.expect(IOException.class);
        thrown.expectMessage("This RandomAccessBuffer has already been closed. It can no longer"
View Full Code Here

  }

  public int sendFileOffer(HTTPUploadedFile file, String message) throws IOException {
    String fnam = file.getFilename();
    String mime = file.getContentType();
    RandomAccessBuffer data = new ByteArrayRandomAccessBuffer(BucketTools.toByteArray(file.getData()));
    return sendFileOffer(fnam, mime, message, data);
  }
View Full Code Here

        }
        return;
      }
      byte[] data = baos.toByteArray();
      long uid = node.fastWeakRandom.nextLong();
      RandomAccessBuffer raf = new ByteArrayRandomAccessBuffer(data);
      PartiallyReceivedBulk prb = new PartiallyReceivedBulk(node.usm, data.length, Node.PACKET_SIZE, raf, true);
      try {
        sendAsync(DMT.createFNPMyFullNoderef(uid, data.length), null, node.nodeStats.foafCounter);
      } catch (NotConnectedException e1) {
        // Ignore
View Full Code Here

      if(receivingFullNoderef) return; // DoS????
      receivingFullNoderef = true;
    }
    try {
      final byte[] data = new byte[length];
      RandomAccessBuffer raf = new ByteArrayRandomAccessBuffer(data);
      PartiallyReceivedBulk prb = new PartiallyReceivedBulk(node.usm, length, Node.PACKET_SIZE, raf, false);
      final BulkReceiver br = new BulkReceiver(prb, this, uid, node.nodeStats.foafCounter);
      node.executor.execute(new Runnable() {

        @Override
View Full Code Here

        if(length != thisLength) {
            fail = true;
        }
    } else {
        prb = new PartiallyReceivedBulk(updateManager.node.getUSM(), 0,
                Node.PACKET_SIZE, new ByteArrayRandomAccessBuffer(new byte[0]), true);
        fail = true;
    }
   
    try {
      bt = new BulkTransmitter(prb, source, uid, false, updateManager.ctr, true);
View Full Code Here

TOP

Related Classes of freenet.support.io.ByteArrayRandomAccessBuffer

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.