/** * Returns an Object which is created using Kryo deserialization of given byte array instance. * * @param buff byte array to be deserialized into an Object */ public Object deserialize(byte[] buff) { input.setBuffer(buff); return kryo.readClassAndObject(input); }
public Object deserializeObject(byte[] ser) { _kryoInput.setBuffer(ser); return _kryo.readClassAndObject(_kryoInput); } }
/** * Returns an Object which is created using Kryo deserialization of given {@code byteBuffer} instance. * * @param byteBuffer byte buffer to be deserialized into an Object */ public Object deserialize(ByteBuffer byteBuffer) { input.setBuffer(byteBuffer.array(), byteBuffer.arrayOffset(), byteBuffer.position()); return kryo.readClassAndObject(input); } }
public List<Object> deserialize(byte[] ser) { _kryoInput.setBuffer(ser); return deserializeFrom(_kryoInput); }
@Override public T deserialize(byte[] b) { input.setBuffer(b); return (T) kryo.readClassAndObject(input); } }
public Tuple deserialize(byte[] ser) { _kryoInput.setBuffer(ser); return deserialize(_kryoInput); }
@Override protected Object deserialize(byte[] data) { input.setBuffer(data); return kryo.readObject(input, ArrayList.class); }
/** * just get target taskId */ public static int deserializeTaskId(byte[] ser) { Input _kryoInput = new Input(1); _kryoInput.setBuffer(ser); return _kryoInput.readInt(); } }
public List<Object> deserialize(byte[] ser) throws IOException { _kryoInput.setBuffer(ser); return deserializeFrom(_kryoInput); }
public Tuple deserialize(byte[] ser, int offset, int count) { _kryoInput.setBuffer(ser, offset, count); return deserialize(_kryoInput); }
public Object deserializeObject(byte[] ser) throws IOException { _kryoInput.setBuffer(ser); return _kryo.readClassAndObject(_kryoInput); }
public Event read(final byte[] bytes) { Input input = new Input(); input.setBuffer(bytes); return (Event)this.kryo.readClassAndObject(input); }
@Override public TupleImpl deserialize(byte[] ser) { try { _kryoInput.setBuffer(ser); int taskId = _kryoInput.readInt(true); int streamId = _kryoInput.readInt(true); String componentName = _context.getComponentId(taskId); String streamName = _ids.getStreamName(componentName, streamId); MessageId id = MessageId.deserialize(_kryoInput); List<Object> values = _kryo.deserializeFrom(_kryoInput); return new TupleImpl(_context, values, componentName, taskId, streamName, id); } catch (IOException e) { throw new RuntimeException(e); } } }
/** * Reads a string encrypted by another instance with a shared key */ private void testEncryptsAndDecryptsMessage(Map<String, Object> topoConf) { String testText = "Tetraodontidae is a family of primarily marine and estuarine fish of the order" + " Tetraodontiformes. The family includes many familiar species, which are" + " variously called pufferfish, puffers, balloonfish, blowfish, bubblefish," + " globefish, swellfish, toadfish, toadies, honey toads, sugar toads, and sea" + " squab.[1] They are morphologically similar to the closely related" + " porcupinefish, which have large external spines (unlike the thinner, hidden" + " spines of Tetraodontidae, which are only visible when the fish has puffed up)." + " The scientific name refers to the four large teeth, fused into an upper and" + " lower plate, which are used for crushing the shells of crustaceans and" + " mollusks, their natural prey."; Kryo kryo = new Kryo(); BlowfishTupleSerializer writerBTS = new BlowfishTupleSerializer(kryo, topoConf); BlowfishTupleSerializer readerBTS = new BlowfishTupleSerializer(kryo, topoConf); int bufferSize = 1024; Output output = new Output(bufferSize, bufferSize); Input input = new Input(bufferSize); String[] stringList = testText.split(" "); ListDelegate delegate = new ListDelegate(); delegate.addAll(Arrays.asList(stringList)); writerBTS.write(kryo, output, delegate); input.setBuffer(output.getBuffer()); ListDelegate outDelegate = readerBTS.read(kryo, input, ListDelegate.class); Assert.assertEquals(testText, Joiner.on(" ").join(outDelegate.toArray())); } }
kryoInput.setBuffer(data); kryoInput.setPosition(13); // Skip targetTaskId, timeStamp, isBatch kryoInput.readInt(true); // Skip sourceTaskId
/** Creates a new Input for reading from a byte array. * @param buffer An exception is thrown if more bytes than this are read. */ public Input (byte[] buffer, int offset, int count) { setBuffer(buffer, offset, count); }
/** Creates a new Input for reading from a byte array. * @param buffer An exception is thrown if more bytes than this are read. */ public Input (byte[] buffer) { setBuffer(buffer, 0, buffer.length); }
/** Creates a new Input for reading from a byte array. * @param buffer An exception is thrown if more bytes than this are read. */ public Input (byte[] buffer, int offset, int count) { setBuffer(buffer, offset, count); }
@Override public Object deserialize(byte[] input) { kryoIn.setBuffer(input); return kryo.readClassAndObject(kryoIn); } }
/** * Returns an Object which is created using Kryo deserialization of given byte array instance. * * @param buff byte array to be deserialized into an Object */ public Object deserialize(byte[] buff) { input.setBuffer(buff); return kryo.readClassAndObject(input); }