All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.javanut.json.encode.JSONKeywords Maven / Gradle / Ivy

Go to download

Ring buffer based queuing utility for applications that require high performance and/or a small footprint. Well suited for embedded and stream based processing.

There is a newer version: 1.1.27
Show newest version
package com.javanut.json.encode;

import com.javanut.pronghorn.util.ByteWriter;

public class JSONKeywords {
    private static final byte[] True = "true".getBytes();
    private static final byte[] False = "false".getBytes();
    private static final byte[] Null = "null".getBytes();
    private static final byte[] Quote = "\"".getBytes();

    private static final byte[] Start = "".getBytes();
    private static final byte[] Complete = "".getBytes();

    private static final byte[] OpenObj = "{".getBytes();
    private static final byte[] CloseObj = "}".getBytes();
    private static final byte[] OpenArray = "[".getBytes();
    private static final byte[] CloseArray = "]".getBytes();

    private static final byte[] FirstObjectElement = "\"".getBytes();
    private static final byte[] NextObjectElement = ",\"".getBytes();
    private static final byte[] ObjectValue = "\":".getBytes();
    private static final byte[] NextArrayElement = ",".getBytes();

    public static JSONKeywords instance = new JSONKeywords();
    
    public void True(ByteWriter writer) {
        writer.write(True);
    }

    public void False(ByteWriter writer) {
        writer.write(False);
    }

    public void Null(ByteWriter writer) {
        writer.write(Null);
    }

    public void Quote(ByteWriter writer) {
        writer.write(Quote);
    }

    public void Start(ByteWriter writer, int depth) {
        writer.write(Start);
    }

    public void Complete(ByteWriter writer, int depth) {
        writer.write(Complete);
    }

    public void OpenObj(ByteWriter writer, int depth) {
        writer.write(OpenObj);
    }

    public void CloseObj(ByteWriter writer, int depth) {
        writer.write(CloseObj);
    }

    public void OpenArray(ByteWriter writer, int depth) {
        writer.write(OpenArray);
    }

    public void CloseArray(ByteWriter writer, int depth) {
        writer.write(CloseArray);
    }

    public void FirstObjectElement(ByteWriter writer, int depth) {
        writer.write(FirstObjectElement);
    }

    public void NextObjectElement(ByteWriter writer, int depth) {
        writer.write(NextObjectElement);
    }

    public void ObjectValue(ByteWriter writer, int depth) {
        writer.write(ObjectValue);
    }

    public void NextArrayElement(ByteWriter writer, int depth) {
        writer.write(NextArrayElement);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy