@Override public void serialize(DataOutput2 out, String value) throws IOException { out.writeUTF(value); }
@Override public void writeBytes(final String s) throws IOException { writeUTF(s); }
@Override public void writeChars(final String s) throws IOException { writeUTF(s); }
@Override public void serialize(DataOutput2 out, String value) throws IOException { out.writeUTF(value); }
@Override public void serialize(DataOutput2 out, String value) throws IOException { out.writeUTF(value); }
@Override public void serialize(DataOutput2 out, Class<?> value) throws IOException { out.writeUTF(value.getName()); }
@Override public void serialize(DataOutput2 out, Map<String, Object> map) throws IOException { Objects.requireNonNull(out); Objects.requireNonNull(map); out.packInt(map.size()); for (String k : map.keySet()) { Object o = map.get(k); if (o instanceof Double) { out.writeUTF("D" + k); out.writeDouble((Double) o); } else if (o instanceof Long) { out.writeUTF("L" + k); out.writeLong((Long) o); } else if (o instanceof String) { out.writeUTF("S" + k); out.writeUTF((String) o); } else if (o instanceof Integer) { out.writeUTF("I" + k); out.writeInt((Integer) o); } else { throw new RuntimeException("Unexpected type " + o.getClass()); } } }
@Override public void serialize(DataOutput2 out, TimeSeriesMetadata metadata) throws IOException { out.writeUTF(metadata.getName()); out.writeUTF(metadata.getDataType().name()); out.writeInt(metadata.getTags().size()); for (Map.Entry<String, String> e : metadata.getTags().entrySet()) { out.writeUTF(e.getKey()); out.writeUTF(e.getValue()); } TimeSeriesIndexSerializer.INSTANCE.serialize(out, metadata.getIndex()); }
@Override public void serialize(@NotNull DataOutput2 out, @NotNull LockDesc value) throws IOException { out.writeByte(VERSION); out.writeUTF(value.getPath()); out.writeUTF(value.getHash()); out.writeUTF(value.getToken()); out.writeUTF(value.getOwner()); if (value.getComment() != null) { out.writeBoolean(true); out.writeUTF(value.getComment()); } else { out.writeBoolean(false); } out.writeLong(value.getCreated()); }
@Override public void serialize(DataOutput2 out, NamedLink namedLink) throws IOException { UuidSerializer.INSTANCE.serialize(out, namedLink.getNodeUuid()); out.writeUTF(namedLink.getName()); }
@Override public void serialize(DataOutput2 out, NodeInfo nodeInfo) throws IOException { UuidSerializer.INSTANCE.serialize(out, MapDbAppStorage.checkNodeId(nodeInfo.getId())); out.writeUTF(nodeInfo.getName()); out.writeUTF(nodeInfo.getPseudoClass()); out.writeUTF(nodeInfo.getDescription()); out.writeLong(nodeInfo.getCreationTime()); out.writeLong(nodeInfo.getModificationTime()); out.writeInt(nodeInfo.getVersion()); out.writeInt(nodeInfo.getGenericMetadata().getStrings().size()); for (Map.Entry<String, String> e : nodeInfo.getGenericMetadata().getStrings().entrySet()) { out.writeUTF(e.getKey()); out.writeUTF(e.getValue()); } out.writeInt(nodeInfo.getGenericMetadata().getDoubles().size()); for (Map.Entry<String, Double> e : nodeInfo.getGenericMetadata().getDoubles().entrySet()) { out.writeUTF(e.getKey()); out.writeDouble(e.getValue()); } out.writeInt(nodeInfo.getGenericMetadata().getInts().size()); for (Map.Entry<String, Integer> e : nodeInfo.getGenericMetadata().getInts().entrySet()) { out.writeUTF(e.getKey()); out.writeInt(e.getValue()); } out.writeInt(nodeInfo.getGenericMetadata().getBooleans().size()); for (Map.Entry<String, Boolean> e : nodeInfo.getGenericMetadata().getBooleans().entrySet()) { out.writeUTF(e.getKey()); out.writeBoolean(e.getValue()); } }
@Override public void serialize(DataOutput2 out, TimeSeriesIndex index) throws IOException { if (index instanceof RegularTimeSeriesIndex) { RegularTimeSeriesIndex regularIndex = (RegularTimeSeriesIndex) index; out.writeUTF("regularIndex"); out.writeLong(regularIndex.getStartTime()); out.writeLong(regularIndex.getEndTime()); out.writeLong(regularIndex.getSpacing()); } else { throw new AssertionError(); } }
@Override public void serialize(DataOutput2 out, TimeSeriesKey key) throws IOException { UuidSerializer.INSTANCE.serialize(out, key.getNodeUuid()); out.writeInt(key.getVersion()); out.writeUTF(key.getTimeSeriesName()); }
@Override public void serialize(DataOutput2 out, StringDataChunk chunk) throws IOException { if (chunk instanceof UncompressedStringDataChunk) { UncompressedStringDataChunk uncompressedChunk = (UncompressedStringDataChunk) chunk; out.writeUTF("uncompressed"); out.writeInt(uncompressedChunk.getOffset()); out.writeInt(uncompressedChunk.getLength()); for (String value : uncompressedChunk.getValues()) { out.writeUTF(value); } } else if (chunk instanceof CompressedStringDataChunk) { CompressedStringDataChunk compressedChunk = (CompressedStringDataChunk) chunk; out.writeUTF("compressed"); out.writeInt(compressedChunk.getOffset()); out.writeInt(compressedChunk.getUncompressedLength()); out.writeInt(compressedChunk.getStepLengths().length); for (int value : compressedChunk.getStepLengths()) { out.writeInt(value); } out.writeInt(compressedChunk.getStepValues().length); for (String value : compressedChunk.getStepValues()) { out.writeUTF(value); } } else { throw new AssertionError(); } }
@Override public void serialize(DataOutput2 out, DoubleDataChunk chunk) throws IOException { if (chunk instanceof UncompressedDoubleDataChunk) { UncompressedDoubleDataChunk uncompressedChunk = (UncompressedDoubleDataChunk) chunk; out.writeUTF("uncompressed"); out.writeInt(uncompressedChunk.getOffset()); out.writeInt(uncompressedChunk.getLength()); for (double value : uncompressedChunk.getValues()) { out.writeDouble(value); } } else if (chunk instanceof CompressedDoubleDataChunk) { CompressedDoubleDataChunk compressedChunk = (CompressedDoubleDataChunk) chunk; out.writeUTF("compressed"); out.writeInt(compressedChunk.getOffset()); out.writeInt(compressedChunk.getUncompressedLength()); out.writeInt(compressedChunk.getStepLengths().length); for (int value : compressedChunk.getStepLengths()) { out.writeInt(value); } out.writeInt(compressedChunk.getStepValues().length); for (double value : compressedChunk.getStepValues()) { out.writeDouble(value); } } else { throw new AssertionError(); } }