Package org.apache.thrift

Examples of org.apache.thrift.TSerializer.serialize()


  }
 
  public static byte[] asByteArray(TCredentials cred) throws AccumuloSecurityException {
    TSerializer ts = new TSerializer();
    try {
      return ts.serialize(cred);
    } catch (TException e) {
      // This really shouldn't happen
      log.error(e, e);
      throw new AccumuloSecurityException(cred.getPrincipal(), SecurityErrorCode.SERIALIZATION_ERROR);
    }
View Full Code Here


  public static byte[] encodeIteratorSettings(IteratorConfig iterators) {
    TSerializer tser = new TSerializer(new TBinaryProtocol.Factory());
   
    try {
      return tser.serialize(iterators);
    } catch (TException e) {
      throw new RuntimeException(e);
    }
  }
 
View Full Code Here

        assert cfDef != null;
        // this is so awful it's kind of cool!
        TSerializer serializer = new TSerializer(new TBinaryProtocol.Factory());
        try
        {
            return Hex.bytesToHex(serializer.serialize(cfDef));
        }
        catch (TException e)
        {
            throw new RuntimeException(e);
        }
View Full Code Here

        indexClause.setExpressions(indexExpressions);
        indexClause.setStart_key("".getBytes());
        TSerializer serializer = new TSerializer(new TBinaryProtocol.Factory());
        try
        {
            return Hex.bytesToHex(serializer.serialize(indexClause));
        }
        catch (TException e)
        {
            throw new RuntimeException(e);
        }
View Full Code Here

        assert cfDef != null;
        // this is so awful it's kind of cool!
        TSerializer serializer = new TSerializer(new TBinaryProtocol.Factory());
        try
        {
            return Hex.bytesToHex(serializer.serialize(cfDef));
        }
        catch (TException e)
        {
            throw new RuntimeException(e);
        }
View Full Code Here

        indexClause.setExpressions(indexExpressions);
        indexClause.setStart_key("".getBytes());
        TSerializer serializer = new TSerializer(new TBinaryProtocol.Factory());
        try
        {
            return Hex.bytesToHex(serializer.serialize(indexClause));
        }
        catch (TException e)
        {
            throw new RuntimeException(e);
        }
View Full Code Here

public class CredentialHelper {

    public static byte[] asByteArray(AuthInfo cred) throws AccumuloSecurityException {
        TSerializer ts = new TSerializer();
        try {
            return ts.serialize(cred);
        } catch (TException e) {
            // This really shouldn't happen
            throw new AccumuloSecurityException(cred.getUser(), SecurityErrorCode.DEFAULT_SECURITY_ERROR, e);
        }
    }
View Full Code Here

        TMemoryBuffer m = new TMemoryBuffer(1000000);
        TFramedTransport t = new TFramedTransport(m);
        TSerializer tt = new TSerializer();
        for (UserProfile up : getObjects()) {
            t.write(tt.serialize(up));
            t.flush();
        }
        return ByteBuffer.wrap(m.getArray(), 0, m.length());

    }
View Full Code Here

            } else {
                testMessage.setEnumField(TestEnum.SOME_OTHER_VALUE);
            }
            byte[] bytes;
            try {
                bytes = serializer.serialize(testMessage);
            } catch(TException e) {
                throw new RuntimeException("Failed to serialize message " + testMessage, e);
            }
            KeyedMessage<String, byte[]> data = new KeyedMessage<String, byte[]>(
                mTopic, Integer.toString(i), bytes);
View Full Code Here

        indexClause.setExpressions(indexExpressions);
        indexClause.setStart_key("".getBytes());
        TSerializer serializer = new TSerializer(new TBinaryProtocol.Factory());
        try
        {
            return Hex.bytesToHex(serializer.serialize(indexClause));
        }
        catch (TException e)
        {
            throw new RuntimeException(e);
        }
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.