Package java.nio

Examples of java.nio.ByteBuffer.compareTo()


      // NOTE(brandyn): Truncate splits that overlap start/end row
      if (startRow != null && curStartKey.compareTo(startRow) < 0) {
          LOG.info("Truncating split...");
          curStartKey = startRow;
      }
      if (stopRow != null && (curEndKey.compareTo(stopRow) > 0 || curEndKey.compareTo(emptyStartRow) == 0)) {
          LOG.info("Truncating split...");
          curEndKey = stopRow;
      }
      splits[curSplit] = new TableSplit(this.table.getTableName(), curStartKey.array(), curEndKey.array(), regionLocation);
      LOG.info("split: " + i + "->" + splits[curSplit]);
View Full Code Here


      // NOTE(brandyn): Truncate splits that overlap start/end row
      if (startRow != null && curStartKey.compareTo(startRow) < 0) {
          LOG.info("Truncating split...");
          curStartKey = startRow;
      }
      if (stopRow != null && (curEndKey.compareTo(stopRow) > 0 || curEndKey.compareTo(emptyStartRow) == 0)) {
          LOG.info("Truncating split...");
          curEndKey = stopRow;
      }
      splits[curSplit] = new TableSplit(this.table.getTableName(), curStartKey.array(), curEndKey.array(), regionLocation);
      LOG.info("split: " + i + "->" + splits[curSplit]);
View Full Code Here

        if (first) {
          first = false;
          LOG.info("First in bottom: " +
            Bytes.toString(Bytes.toBytes(previous)));
        }
        assertTrue(key.compareTo(bbMidkeyBytes) < 0);
      }
      if (previous != null) {
        LOG.info("Last in bottom: " + Bytes.toString(Bytes.toBytes(previous)));
      }
      // Remove references.
View Full Code Here

     * @param header The tar entry header buffer to evaluate the format for.
     * @return format type
     */
    private int evaluateType(byte[] header) {
        final ByteBuffer magic = ByteBuffer.wrap(header, MAGIC_OFFSET, MAGICLEN);
        if (magic.compareTo(ByteBuffer.wrap(MAGIC_GNU.getBytes())) == 0)
            return FORMAT_OLDGNU;
        if (magic.compareTo(ByteBuffer.wrap(MAGIC_POSIX.getBytes())) == 0)
            return FORMAT_POSIX;
        return 0;
    }
View Full Code Here

     */
    private int evaluateType(byte[] header) {
        final ByteBuffer magic = ByteBuffer.wrap(header, MAGIC_OFFSET, MAGICLEN);
        if (magic.compareTo(ByteBuffer.wrap(MAGIC_GNU.getBytes())) == 0)
            return FORMAT_OLDGNU;
        if (magic.compareTo(ByteBuffer.wrap(MAGIC_POSIX.getBytes())) == 0)
            return FORMAT_POSIX;
        return 0;
    }
}

View Full Code Here

            buf.clear();
            ByteBuffer other = ByteBuffer.allocate(buf.capacity());
            loadTestData1(buf);
            loadTestData1(other);
            assertEquals(0, buf.compareTo(other));
            assertEquals(0, other.compareTo(buf));
            buf.position(1);
            assertTrue(buf.compareTo(other) > 0);
            assertTrue(other.compareTo(buf) < 0);
            other.position(2);
            assertTrue(buf.compareTo(other) < 0);
View Full Code Here

            loadTestData1(other);
            assertEquals(0, buf.compareTo(other));
            assertEquals(0, other.compareTo(buf));
            buf.position(1);
            assertTrue(buf.compareTo(other) > 0);
            assertTrue(other.compareTo(buf) < 0);
            other.position(2);
            assertTrue(buf.compareTo(other) < 0);
            assertTrue(other.compareTo(buf) > 0);
            buf.position(2);
            other.limit(SMALL_TEST_LENGTH);
View Full Code Here

            buf.position(1);
            assertTrue(buf.compareTo(other) > 0);
            assertTrue(other.compareTo(buf) < 0);
            other.position(2);
            assertTrue(buf.compareTo(other) < 0);
            assertTrue(other.compareTo(buf) > 0);
            buf.position(2);
            other.limit(SMALL_TEST_LENGTH);
            assertTrue(buf.compareTo(other) > 0);
            assertTrue(other.compareTo(buf) < 0);
        }
View Full Code Here

            assertTrue(buf.compareTo(other) < 0);
            assertTrue(other.compareTo(buf) > 0);
            buf.position(2);
            other.limit(SMALL_TEST_LENGTH);
            assertTrue(buf.compareTo(other) > 0);
            assertTrue(other.compareTo(buf) < 0);
        }
       
        assertTrue(ByteBuffer.wrap(new byte[21]).compareTo(ByteBuffer.allocateDirect(21)) == 0);
    }
View Full Code Here

        if (first) {
          first = false;
          LOG.info("First in bottom: " +
            Bytes.toString(Bytes.toBytes(previous)));
        }
        assertTrue(key.compareTo(bbMidkeyBytes) < 0);
      }
      if (previous != null) {
        LOG.info("Last in bottom: " + Bytes.toString(Bytes.toBytes(previous)));
      }
      // Remove references.
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.