@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); }
@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); }
@Override public void write(Kryo kryo, Output output, PyLong object) { byte[] data = object.getValue().toByteArray(); output.writeShort(data.length); output.writeBytes(data); }
private void writeValue(Output output, BytesWritable bytesWritable) { int size = bytesWritable.getLength(); output.writeInt(size); output.writeBytes(bytesWritable.getBytes(), 0, size); }
private void writeValue(Output output, BytesWritable bytesWritable) { int size = bytesWritable.getLength(); output.writeInt(size); output.writeBytes(bytesWritable.getBytes(), 0, size); }
private void writeHiveKey(Output output, HiveKey hiveKey) { int size = hiveKey.getLength(); output.writeInt(size); output.writeBytes(hiveKey.getBytes(), 0, size); output.writeInt(0); // Since hashCode is not used, just put an arbitrary number output.writeInt(hiveKey.getDistKeyLength()); }
private void writeHiveKey(Output output, HiveKey hiveKey) { int size = hiveKey.getLength(); output.writeInt(size); output.writeBytes(hiveKey.getBytes(), 0, size); output.writeInt(hiveKey.hashCode()); output.writeInt(hiveKey.getDistKeyLength()); }
@Override public void writeBytes(final byte[] array, final int offset, final int count) { unshadedOutput.writeBytes(array, offset, count); }
@Override public void write(Kryo kryo, Output output) { int numVariableMappings = variableMappings.isEmpty()?0:variableMappings.size(); output.writeShort(numVariableMappings); for(Map m : variableMappings) { byte[] b = m == null?new byte[]{}:SerDeUtils.toBytes(m); output.writeInt(b.length); if(b.length > 0) { output.writeBytes(b); } } }
/** Writes the bytes. Note the byte[] length is not written. */ public void write (byte[] bytes, int offset, int length) throws KryoException { writeBytes(bytes, offset, length); }
@Override public void write(Kryo kryo, Output output) { //storing tdigest ByteBuffer outBuffer = ByteBuffer.allocate(digest.byteSize()); digest.asBytes(outBuffer); byte[] tdigestSerialized = outBuffer.array(); output.writeInt(tdigestSerialized.length); output.writeBytes(tdigestSerialized); output.writeLong(n); output.writeDouble(sum); output.writeDouble(sumOfSquares); output.writeDouble(sumOfLogs); output.writeDouble(getMin()); output.writeDouble(getMax()); output.writeDouble(M1); output.writeDouble(M2); output.writeDouble(M3); output.writeDouble(M4); }
/** Writes the bytes. Note the byte[] length is not written. */ public void writeBytes (byte[] bytes) throws KryoException { if (bytes == null) throw new IllegalArgumentException("bytes cannot be null."); writeBytes(bytes, 0, bytes.length); }
/** Writes the bytes. Note the byte[] length is not written. */ public void write (byte[] bytes) throws KryoException { if (bytes == null) throw new IllegalArgumentException("bytes cannot be null."); writeBytes(bytes, 0, bytes.length); }
/** Writes the bytes. Note the byte[] length is not written. */ public void write (byte[] bytes) throws KryoException { if (bytes == null) throw new IllegalArgumentException("bytes cannot be null."); writeBytes(bytes, 0, bytes.length); }
@Override public Encoder writeBytes(byte[] bytes, int off, int len) throws IOException { output.writeInt(len); output.writeBytes(bytes, off, len); return this; }
@Override public Encoder writeBytes(byte[] bytes, int off, int len) throws IOException { output.writeInt(len); output.writeBytes(bytes, off, len); return this; }
public void write (Kryo kryo, Output output, byte[] object) { if (object == null) { output.writeVarInt(NULL, true); return; } output.writeVarInt(object.length + 1, true); output.writeBytes(object); }
public void write (Kryo kryo, Output output, byte[] object) { if (object == null) { output.writeVarInt(NULL, true); return; } output.writeVarInt(object.length + 1, true); output.writeBytes(object); }
@Override public void write(Kryo kryo, Output output, Message mes) { byte[] ser = mes.toByteArray(); output.writeInt(ser.length, true); output.writeBytes(ser); }
@Override public void write(Kryo kryo, Output output, IpPrefix object) { byte[] octs = object.address().toOctets(); output.writeInt(octs.length); output.writeBytes(octs); output.writeInt(object.prefixLength()); }