@Override public void writeInt(int v) throws IOException { output.writeInt(v); }
@Override public void writeInt(int v) throws IOException { output.writeInt(v); }
@Override public void writeBytes(byte[] v) throws IOException { if (v == null) { output.writeInt(-1); } else { writeBytes(v, 0, v.length); } }
@Override public void writeBytes(byte[] v) throws IOException { if (v == null) { output.writeInt(-1); } else { writeBytes(v, 0, v.length); } }
@Override public void write(Kryo kryo, Output output, PyInteger object) { output.writeInt(object.getValue()); }
@Override public void write(Kryo kryo, Output output, ByteBuffer object) { output.writeInt(object.array().length); output.write(object.array()); }
@Override public void write(Kryo kryo, Output output, Object object) { ByteArrayOutputStream bos = new ByteArrayOutputStream(); try { ObjectOutputStream oos = new ObjectOutputStream(bos); oos.writeObject(object); oos.flush(); } catch (IOException e) { throw new RuntimeException(e); } byte[] ser = bos.toByteArray(); output.writeInt(ser.length); output.writeBytes(ser); }
private void serializeStrings(List<Object> values, Output out) { out.writeInt(values.size(), true); for (Object o : values) { String str = (String) o; out.writeString(str); } }
public void serialize(Output out) throws IOException { out.writeInt(_anchorsToIds.size(), true); for (Entry<Long, Long> anchorToId : _anchorsToIds.entrySet()) { out.writeLong(anchorToId.getKey()); out.writeLong(anchorToId.getValue()); } } }
@Override public void write(Kryo kryo, Output output, LocalDate localDate) { output.writeInt(localDate.getYear()); output.writeInt(localDate.getMonthOfYear()); output.writeInt(localDate.getDayOfMonth()); final Chronology chronology = localDate.getChronology(); if (chronology != null && chronology != ISOChronology.getInstanceUTC()) { throw new RuntimeException("Unsupported chronology: " + chronology); } }
public void serialize(Output out) throws IOException { out.writeInt(_anchorsToIds.size(), true); for (Entry<Long, Long> anchorToId : _anchorsToIds.entrySet()) { out.writeLong(anchorToId.getKey()); out.writeLong(anchorToId.getValue()); } }
@Override public void write(Kryo kryo, Output output, TupleImpl tuple) { byte[] bytes = tupleSerializer.serialize(tuple); output.writeInt(bytes.length); output.write(bytes); }
@Override public void write(Kryo kryo, Output output, LocalTime object) { final int time = object.getMillisOfDay(); output.writeInt(time, true); final Chronology chronology = object.getChronology(); if (chronology != null && chronology != ISOChronology.getInstanceUTC()) { throw new RuntimeException("Unsupported chronology: " + chronology); } }
@Override public void write(Kryo kryo, Output output, TestRecord object) { output.writeInt(object.buffer.length); output.write(object.buffer); }
public void write(Kryo kryo, Output output, PyObject po) { try { byte[] serPo = SerializationUtils.serializeObject(po); output.writeInt(serPo.length); output.write(serPo); } catch (IOException e) { throw new KryoException("Failed to serialize object.", e); } }
public byte[] serialize(Tuple tuple) { try { _kryoOut.clear(); _kryoOut.writeInt(tuple.getSourceTask(), true); _kryoOut.writeInt(_ids.getStreamId(tuple.getSourceComponent(), tuple.getSourceStreamId()), true); tuple.getMessageId().serialize(_kryoOut); _kryo.serializeInto(tuple.getValues(), _kryoOut); return _kryoOut.toBytes(); } catch (IOException e) { throw new RuntimeException(e); } }