org.mapdb.Serializer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mapdb Show documentation
Show all versions of mapdb Show documentation
MapDB provides concurrent Maps, Sets and Queues backed by disk storage or off-heap memory. It is a fast, scalable and easy to use embedded Java database.
/*
* Copyright (c) 2012 Jan Kotek
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.mapdb;
import org.jetbrains.annotations.NotNull;
import org.mapdb.serializer.*;
import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;
/**
* Provides serialization and deserialization
*
* @author Jan Kotek
*/
public interface Serializer extends Comparator{
GroupSerializer CHAR = new SerializerChar();
/**
*
* Serializes strings using UTF8 encoding.
* Stores string size so can be used as collection serializer.
* Does not handle null values
*
* Unlike {@link Serializer#STRING} this method hashes String with {@link String#hashCode()}
*
*/
GroupSerializer STRING_ORIGHASH = new SerializerStringOrigHash();
/**
* Serializes strings using UTF8 encoding.
* Stores string size so can be used as collection serializer.
* Does not handle null values
*/
GroupSerializer STRING = new SerializerString();
GroupSerializer STRING_DELTA = new SerializerStringDelta();
GroupSerializer STRING_DELTA2 = new SerializerStringDelta2();
/**
* Serializes strings using UTF8 encoding.
* Deserialized String is interned {@link String#intern()},
* so it could save some memory.
*
* Stores string size so can be used as collection serializer.
* Does not handle null values
*/
GroupSerializer STRING_INTERN = new SerializerStringIntern();
/**
* Serializes strings using ASCII encoding (8 bit character).
* Is faster compared to UTF8 encoding.
* Stores string size so can be used as collection serializer.
* Does not handle null values
*/
GroupSerializer STRING_ASCII = new SerializerStringAscii();
/**
* Serializes strings using UTF8 encoding.
* Used mainly for testing.
* Does not handle null values.
*/
Serializer STRING_NOSIZE = new SerializerStringNoSize();
/** Serializes Long into 8 bytes, used mainly for testing.
* Does not handle null values.*/
GroupSerializer LONG = new SerializerLong();
/**
* Packs positive LONG, so smaller positive values occupy less than 8 bytes.
* Large and negative values could occupy 8 or 9 bytes.
*/
GroupSerializer LONG_PACKED = new SerializerLongPacked();
/**
* Applies delta packing on {@code java.lang.Long}.
* Difference between consequential numbers is also packed itself, so for small diffs it takes only single byte per
* number.
*/
GroupSerializer LONG_DELTA = new SerializerLongDelta();
/** Serializes Integer into 4 bytes, used mainly for testing.
* Does not handle null values.*/
GroupSerializer INTEGER = new SerializerInteger();
/**
* Packs positive Integer, so smaller positive values occupy less than 4 bytes.
* Large and negative values could occupy 4 or 5 bytes.
*/
GroupSerializer INTEGER_PACKED = new SerializerIntegerPacked();
/**
* Applies delta packing on {@code java.lang.Integer}.
* Difference between consequential numbers is also packed itself, so for small diffs it takes only single byte per
* number.
*/
GroupSerializer INTEGER_DELTA = new SerializerIntegerDelta();
GroupSerializer BOOLEAN = new SerializerBoolean();
;
/** Packs recid + it adds 3bits checksum. */
GroupSerializer RECID = new SerializerRecid();
GroupSerializer RECID_ARRAY = new SerializerRecidArray();
/**
* Always throws {@link IllegalAccessError} when invoked. Useful for testing and assertions.
*/
GroupSerializer