Examples of fromBytes()


Examples of com.twitter.chill.KryoPool.fromBytes()

    @Test
    public void testGenericRecord() throws Exception {
        ClassTag<GenericData.Record> tag = getClassTag(GenericData.Record.class);
        KryoPool kryo = getKryo(tag, AvroSerializer$.MODULE$.GenericRecordSerializer(schema,tag));
        byte[] userBytes = kryo.toBytesWithClass(user);
        GenericData.Record userResult = (GenericData.Record) kryo.fromBytes(userBytes);
        assertEquals(userResult.get("name").toString(),"Jeff");
        assertEquals(userResult.get("ID"),1);
        assertEquals(user.toString(), userResult.toString());

    }
View Full Code Here

Examples of org.apache.accumulo.core.tabletserver.log.LogEntry.fromBytes()

    while (true) {
      result.clear();
      for (String child : zoo.getChildren(root)) {
        LogEntry e = new LogEntry();
        try {
          e.fromBytes(zoo.getData(root + "/" + child, null));
          // upgrade from !0;!0<< -> +r<<
          e.extent = RootTable.EXTENT;
          result.add(e);
        } catch (KeeperException.NoNodeException ex) {
          continue;
View Full Code Here

Examples of org.apache.accumulo.core.tabletserver.log.LogEntry.fromBytes()

          List<Collection<String>> logs = new ArrayList<Collection<String>>();
          for (String entry : store.getChildren(RootTable.ZROOT_TABLET_WALOGS)) {
            byte[] logInfo = store.get(RootTable.ZROOT_TABLET_WALOGS + "/" + entry);
            if (logInfo != null) {
              LogEntry logEntry = new LogEntry();
              logEntry.fromBytes(logInfo);
              logs.add(logEntry.logSet);
              log.debug("root tablet logSet " + logEntry.logSet);
            }
          }
          TabletLocationState result = new TabletLocationState(RootTable.EXTENT, futureSession, currentSession, lastSession, logs, false);
View Full Code Here

Examples of org.apache.accumulo.core.tabletserver.log.LogEntry.fromBytes()

    while (true) {
      result.clear();
      for (String child : zoo.getChildren(root)) {
        LogEntry e = new LogEntry();
        try {
          e.fromBytes(zoo.getData(root + "/" + child, null));
          // upgrade from !0;!0<< -> +r<<
          e.extent = RootTable.EXTENT;
          result.add(e);
        } catch (KeeperException.NoNodeException ex) {
          continue;
View Full Code Here

Examples of org.geowebcache.diskquota.storage.StorageUnit.fromBytes()

        public void marshal(Object source, HierarchicalStreamWriter writer,
                MarshallingContext context) {
            Quota quota = (Quota) source;
            BigInteger bytes = quota.getBytes();
            StorageUnit unit = StorageUnit.bestFit(bytes);
            BigDecimal value = unit.fromBytes(bytes);

            writer.startNode("value");
            writer.setValue(value.toString());
            writer.endNode();
View Full Code Here

Examples of org.lilyproject.repository.api.IdGenerator.fromBytes()

    @Test
    public void testIdGeneratorDefault() {
        IdGenerator idGenerator = new IdGeneratorImpl();
        RecordId recordId = idGenerator.newRecordId();
        assertEquals(recordId, idGenerator.fromBytes(recordId.toBytes()));
        assertEquals(recordId, idGenerator.fromString(recordId.toString()));
    }

    @Test
    public void testUUID() {
View Full Code Here

Examples of org.lilyproject.repository.api.IdGenerator.fromBytes()

        // Check it's not recognized as a variant
        assertTrue(idGenerator.fromString(uuidRecordIDString).isMaster());

        // Test bytes representation
        byte[] uuidRecordIdBytes = new byte[] {1, -46, 124, -37, 110, -82, 109, 17, -49, -106, -72, 68, 69, 83, 84, 0, 0};
        assertArrayEquals(uuidRecordIdBytes, idGenerator.fromBytes(uuidRecordIdBytes).toBytes());

        assertEquals(uuidRecordIDString, idGenerator.fromBytes(uuidRecordIdBytes).toString());

    }
View Full Code Here

Examples of org.lilyproject.repository.api.IdGenerator.fromBytes()

        // Test bytes representation
        byte[] uuidRecordIdBytes = new byte[] {1, -46, 124, -37, 110, -82, 109, 17, -49, -106, -72, 68, 69, 83, 84, 0, 0};
        assertArrayEquals(uuidRecordIdBytes, idGenerator.fromBytes(uuidRecordIdBytes).toBytes());

        assertEquals(uuidRecordIDString, idGenerator.fromBytes(uuidRecordIdBytes).toString());

    }

    @Test
    public void testUSER() {
View Full Code Here

Examples of org.lilyproject.repository.api.IdGenerator.fromBytes()

        assertEquals(newRecordId, idGenerator.fromString(userRecordIDString));
        assertEquals(userRecordIDString, idGenerator.fromString(userRecordIDString).toString());

        // Test bytes representation cycle
        byte[] userRecordIdBytes = newRecordId.toBytes();
        assertArrayEquals(userRecordIdBytes, idGenerator.fromBytes(userRecordIdBytes).toBytes());

        assertEquals(userRecordIDString, idGenerator.fromBytes(userRecordIdBytes).toString());

        // Test the bytes representation is really what we expect it to be
        byte[] idBytes = new byte[] {0, 65, 66, 67};
View Full Code Here

Examples of org.lilyproject.repository.api.IdGenerator.fromBytes()

        // Test bytes representation cycle
        byte[] userRecordIdBytes = newRecordId.toBytes();
        assertArrayEquals(userRecordIdBytes, idGenerator.fromBytes(userRecordIdBytes).toBytes());

        assertEquals(userRecordIDString, idGenerator.fromBytes(userRecordIdBytes).toString());

        // Test the bytes representation is really what we expect it to be
        byte[] idBytes = new byte[] {0, 65, 66, 67};
        String idString = "USER.ABC";
        assertArrayEquals(idBytes, idGenerator.fromString(idString).toBytes());
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.