Examples of readBytes()


Examples of org.tmatesoft.hg.internal.DataAccess.readBytes()

  private DataAccess getDataStream() throws IOException {
    DataAccess da = accessProvider.createReader(bundleFile, false);
    byte[] signature = new byte[6];
    if (da.length() > 6) {
      da.readBytes(signature, 0, 6);
      if (signature[0] == 'H' && signature[1] == 'G' && signature[2] == '1' && signature[3] == '0') {
        if (signature[4] == 'G' && signature[5] == 'Z') {
          return new InflaterDataAccess(da, 6, da.length() - 6);
        }
        if (signature[4] == 'B' && signature[5] == 'Z') {
View Full Code Here

Examples of org.tmatesoft.hg.internal.InflaterDataAccess.readBytes()

    ByteBuffer chunk1 = ByteBuffer.allocate(bufferCapacity);
    ida.readBytes(chunk1);
    errorCollector.assertTrue(new ByteArraySlice(testContent1, 20, bufferCapacity).equalsTo(chunk1.array()));
    ida.skip(-bufferCapacity);
    ByteBuffer chunk2 = ByteBuffer.allocate(bufferCapacity);
    ida.readBytes(chunk2);
    errorCollector.assertEquals(chunk1, chunk2);
  }
 
  @Test
  public void testLength() throws Exception {
View Full Code Here

Examples of org.tmatesoft.hg.internal.InflaterDataAccess.readBytes()

    errorCollector.assertEquals("#length() after readBytes()", testContent1.length, ida.length());
    //
    ida = new InflaterDataAccess(zip, 0, zip.length(), -1, new Inflater(), new byte[25], null);
    // consume most of the stream, so that all original compressed data is already read
    dummy = new byte[testContent1.length - 1];
    ida.readBytes(dummy, 0, dummy.length);
    errorCollector.assertEquals("#length() after origin was completely read", testContent1.length, ida.length());
    //
    errorCollector.assertFalse(ida.isEmpty()); // check InflaterDataAccess#available() positive
  }
View Full Code Here

Examples of org.tmatesoft.hg.internal.InflaterDataAccess.readBytes()

  public void testReadBytes() throws Exception {
    DataAccess zip = zip(testContent1);
    InflaterDataAccess ida = new InflaterDataAccess(zip, 0, zip.length(), -1, new Inflater(), new byte[25], null);
    ida.skip(10);
    byte[] chunk1 = new byte[22];
    ida.readBytes(chunk1, 0, 20);
    chunk1[20] = ida.readByte();
    chunk1[21] = ida.readByte();
    ida.skip(5);
    byte[] chunk2 = new byte[12];
    chunk2[0] = ida.readByte();
View Full Code Here

Examples of org.tmatesoft.hg.internal.InflaterDataAccess.readBytes()

    chunk1[21] = ida.readByte();
    ida.skip(5);
    byte[] chunk2 = new byte[12];
    chunk2[0] = ida.readByte();
    chunk2[1] = ida.readByte();
    ida.readBytes(chunk2, 2, 10);
    errorCollector.assertTrue(new ByteArraySlice(testContent1, 10, 22).equalsTo(chunk1));
    errorCollector.assertTrue(new ByteArraySlice(testContent1, 10+22+5, 12).equalsTo(chunk2));
    int consumed = 10+22+5+12;
    //
    // check that even when original content is completely unpacked, leftovers in the outBuffer are recognized  
View Full Code Here

Examples of org.tmatesoft.hg.internal.InflaterDataAccess.readBytes()

    errorCollector.assertTrue(new ByteArraySlice(testContent1, 10, 22).equalsTo(chunk1));
    errorCollector.assertTrue(new ByteArraySlice(testContent1, 10+22+5, 12).equalsTo(chunk2));
    int consumed = 10+22+5+12;
    //
    // check that even when original content is completely unpacked, leftovers in the outBuffer are recognized  
    ida.readBytes(ByteBuffer.allocate(testContent1.length - consumed - 2)); // unpack up to an end (almost)
    errorCollector.assertFalse(ida.isEmpty()); // check InflaterDataAccess#available() positive
    //
    ByteBuffer chunk3 = ByteBuffer.allocate(10);
    ida.readBytes(chunk3);
    errorCollector.assertEquals(2, chunk3.flip().remaining());
View Full Code Here

Examples of org.tmatesoft.hg.internal.InflaterDataAccess.readBytes()

    // check that even when original content is completely unpacked, leftovers in the outBuffer are recognized  
    ida.readBytes(ByteBuffer.allocate(testContent1.length - consumed - 2)); // unpack up to an end (almost)
    errorCollector.assertFalse(ida.isEmpty()); // check InflaterDataAccess#available() positive
    //
    ByteBuffer chunk3 = ByteBuffer.allocate(10);
    ida.readBytes(chunk3);
    errorCollector.assertEquals(2, chunk3.flip().remaining());
  }

  private static class ByteArraySlice {
    public final byte[] array;
View Full Code Here

Examples of org.xmlBlaster.jms.XBBytesMessage.readBytes()

            XBDestination dest = new XBDestination("someTopic", null);
            msg.setJMSDestination(dest);
            msg.reset();
           
            byte[] content2 = new byte[256];
            msg.readBytes(content2);
            for (int i=0; i < content.length; i++)
               assertEquals("byte nr. '" + i + "' is wrong", content[i], content2[i]);
         }
         { // 1. key, content and qos all null in constructor
            byte[] content = null;
View Full Code Here

Examples of promauto.utils.RpSerialPort.readBytes()

         
      // Command - readhex
      if (cmd[1].equals("readhex") || cmd[1].equals("rh")) {
        RpSerialPort port = getPortForConsoleCommand(cmd);
        byte[] bin = new byte[2048];
        int n = port.readBytes(bin);
        byte[] bb = Arrays.copyOfRange(bin, 0, Math.abs(n));
        svcConsole.write(JRoboStrings.SVCSERIAL_READ_FROM + port.getName()+": "+ RpHyperstring.bytesToHexString(bb) +"\n" );
      } else
         
      // Command - write and read string
View Full Code Here

Examples of streamer.ByteBuffer.readBytes()

                break;
            case MSV_AV_DNS_COMPUTER_NAME:
                System.out.println("AV DNS Computer name: " + data.readString(length, RdpConstants.CHARSET_16));
                break;
            case MSV_AV_CHANNEL_BINDINGS:
                System.out.println("AV Channel Bindings: " + data.readBytes(length).toPlainHexString());
                break;
            case MSV_AV_TIMESTAMP:
                System.out.println("AV Timestamp: " + data.readBytes(length).toPlainHexString());
                break;
            case MSV_AV_FLAGS:
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.