use of co.cask.cdap.common.io.Decoder in project cdap by caskdata.
the class AccessTokenIdentifierCodec method decode.
@Override
public AccessTokenIdentifier decode(byte[] data) throws IOException {
ByteArrayInputStream bis = new ByteArrayInputStream(data);
Decoder decoder = new BinaryDecoder(bis);
DatumReader<AccessTokenIdentifier> reader = readerFactory.create(ACCESS_TOKEN_IDENTIFIER_TYPE, AccessTokenIdentifier.Schemas.getCurrentSchema());
int readVersion = decoder.readInt();
Schema readSchema = AccessTokenIdentifier.Schemas.getSchemaVersion(readVersion);
if (readSchema == null) {
throw new IOException("Unknown schema version for AccessTokenIdentifier: " + readVersion);
}
return reader.read(decoder, readSchema);
}
Aggregations