Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,12 @@ private Constants() {} // can't construct
JVM_MAJOR_VERSION > 1 || (JVM_MAJOR_VERSION == 1 && JVM_MINOR_VERSION >= 9);
public static final boolean JRE_IS_MINIMUM_JAVA11 =
JVM_MAJOR_VERSION > 1 || (JVM_MAJOR_VERSION == 1 && JVM_MINOR_VERSION >= 11);

public static class None {
private None() {
// Singleton
}
}

public static final None NONE = new None();
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
import static org.apache.tsfile.utils.ReadWriteIOUtils.ClassSerializeId.FLOAT;
import static org.apache.tsfile.utils.ReadWriteIOUtils.ClassSerializeId.INTEGER;
import static org.apache.tsfile.utils.ReadWriteIOUtils.ClassSerializeId.LONG;
import static org.apache.tsfile.utils.ReadWriteIOUtils.ClassSerializeId.NONE;
import static org.apache.tsfile.utils.ReadWriteIOUtils.ClassSerializeId.NULL;
import static org.apache.tsfile.utils.ReadWriteIOUtils.ClassSerializeId.STRING;

Expand Down Expand Up @@ -1168,7 +1169,8 @@ public enum ClassSerializeId {
BOOLEAN,
STRING,
TAG,
NULL
NULL,
NONE,
}

public static void writeObject(Object value, DataOutputStream outputStream) {
Expand All @@ -1195,6 +1197,8 @@ public static void writeObject(Object value, DataOutputStream outputStream) {
outputStream.write(Boolean.TRUE.equals(value) ? 1 : 0);
} else if (value == null) {
outputStream.write(NULL.ordinal());
} else if (value == Constants.NONE) {
outputStream.write(NONE.ordinal());
} else {
outputStream.write(STRING.ordinal());
byte[] bytes = value.toString().getBytes();
Expand Down Expand Up @@ -1229,6 +1233,8 @@ public static void writeObject(Object value, ByteBuffer byteBuffer) {
byteBuffer.put(Boolean.TRUE.equals(value) ? (byte) 1 : (byte) 0);
} else if (value == null) {
byteBuffer.putInt(NULL.ordinal());
} else if (value == Constants.NONE) {
byteBuffer.putInt(NONE.ordinal());
} else {
byteBuffer.putInt(STRING.ordinal());
byte[] bytes = value.toString().getBytes();
Expand Down Expand Up @@ -1257,6 +1263,8 @@ public static Object readObject(ByteBuffer buffer) {
return new Binary(bytes);
case NULL:
return null;
case NONE:
return Constants.NONE;
case STRING:
default:
length = buffer.getInt();
Expand Down
Loading