@Override
    public void writeValue(final T value, final Buffer buffer, final GraphBinaryWriter context, final boolean nullable) throws IOException {
        if (value == null) {
            if (!nullable) {
                throw new IOException("Unexpected null value when nullable is false");
            }

            context.writeValueFlagNull(buffer);
            return;
        }

        if (nullable) {
            if (value instanceof LinkedHashMap) {
                context.writeValueFlagOrdered(buffer);
            } else if (value instanceof BulkSet) {
                context.writeValueFlagBulk(buffer);
            } else {
                context.writeValueFlagNone(buffer);
            }
        }

        writeValue(value, buffer, context);
    }
Reads a non-nullable value according to the type format.

@param buffer  A buffer which reader index has been set to the beginning of the {value}.
@param context The binary reader.
@throws IOException
@since 4.0.0
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/SimpleTypeSerializer.java