@Override public void write(WriteBuffer buffer, Geoshape attribute) { try { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); GeoshapeBinarySerializer.write(outputStream, attribute); byte[] bytes = outputStream.toByteArray(); VariableLong.writePositive(buffer,bytes.length); buffer.putBytes(bytes); } catch (IOException e) { throw new RuntimeException("I/O exception writing geoshape", e); } } }
@Override public void write(Kryo kryo, Output output, Geoshape geoshape) { try { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); GeoshapeBinarySerializer.write(outputStream, geoshape); byte[] bytes = outputStream.toByteArray(); output.writeLong(bytes.length); output.write(bytes); } catch (IOException e) { throw new RuntimeException("I/O exception writing geoshape", e); } }
@Override public void write(Kryo kryo, Output output, Geoshape geoshape) { try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream()) { Geoshape.GeoshapeBinarySerializer.write(outputStream, geoshape); byte[] bytes = outputStream.toByteArray(); output.write(bytes.length); output.write(bytes); } catch (IOException e) { throw new RuntimeException("I/O exception writing geoshape"); } }
@Override public void write(Kryo kryo, Output output, Geoshape geoshape) { try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream()) { Geoshape.GeoshapeBinarySerializer.write(outputStream, geoshape); byte[] bytes = outputStream.toByteArray(); output.write(bytes.length); output.write(bytes); } catch (IOException e) { throw new RuntimeException("I/O exception writing geoshape"); } }