Package org.kiji.schema.avro

Examples of org.kiji.schema.avro.SecurityUserList


    List<KijiUserRecord> userRecordList = Lists.newArrayList();
    for (KijiUser user: users) {
      userRecordList.add(KijiUserRecord.newBuilder().setName(user.getName()).build());
    }
    // Create SecurityUserList to serialize.
    SecurityUserList userList = SecurityUserList.newBuilder().setUsers(userRecordList).build();

    // Write it out.
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    Encoder encoder = EncoderFactory.get().directBinaryEncoder(out, null);
    SpecificDatumWriter<SecurityUserList> writer =
View Full Code Here


   */
  public static Set<KijiUser> deserializeKijiUsers(byte[] bytes) throws IOException {
    SpecificDatumReader<SecurityUserList> reader =
        new SpecificDatumReader<SecurityUserList>(SecurityUserList.SCHEMA$);
    Decoder decoder = DecoderFactory.get().binaryDecoder(bytes, null);
    SecurityUserList securityUserList = reader.read(null, decoder);

    Set<KijiUser> result = new HashSet<KijiUser>();
    for (KijiUserRecord userRecord : securityUserList.getUsers()) {
      result.add(KijiUser.fromName(userRecord.getName()));
    }
    return result;
  }
View Full Code Here

TOP

Related Classes of org.kiji.schema.avro.SecurityUserList

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.