aboutsummaryrefslogtreecommitdiffstats
path: root/document/src/main/java/com/yahoo/document/serialization/DocumentSerializerFactory.java
blob: beacf5e367d57c18843d6554972e6d0e0aed06f2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.document.serialization;

import com.yahoo.io.GrowableByteBuffer;

/**
 * Factory for creating document serializers tied to a document format.
 *
 * @author geirst
 */
public class DocumentSerializerFactory {

    /**
     * Creates a serializer for the current head document format.
     * This format is an extension of the 6.x format.
     */
    public static DocumentSerializer createHead(GrowableByteBuffer buf) {
        return new VespaDocumentSerializerHead(buf);
    }

    /**
     * Creates a serializer for the 6.x document format.
     * This format is an extension of the 4.2 format.
     */
    public static DocumentSerializer create6(GrowableByteBuffer buf) {
        return new VespaDocumentSerializer6(buf);
    }

    /**
     * Creates a serializer for the 6.x document format.
     * This format is an extension of the 4.2 format.
     */
    public static DocumentSerializer create6() {
        return new VespaDocumentSerializer6(new GrowableByteBuffer(8 * 1024, 2.0f));
    }

}