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

com.antiaction.common.json.JSONDecoder Maven / Gradle / Ivy

There is a newer version: 0.7.0
Show newest version
/*
 * JSON library.
 * Copyright 2012-2013 Antiaction (http://antiaction.com/)
 *
 * 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 com.antiaction.common.json;

import java.io.IOException;
import java.io.InputStream;
import java.nio.CharBuffer;

/**
 * Interface for JSON decoders to implement.
 * Implementations will most likely not be thread safe!
 *
 * @author Nicholas
 * Created on 10/09/2012
 */
public interface JSONDecoder {

	/**
	 * Initialize Decoder with an InputStream.
	 * @param in encoded JSON text InputStream
	 */
	public void init(InputStream in);

	/**
	 * Fill char buffer with as much decoded JSON text as possible.
	 * @param charBuffer char buffer for decoded JSON text
	 * @return EOF boolean indication
	 * @throws IOException if an i/o error was encountered during decoding
	 */
	public boolean fill(CharBuffer charBuffer) throws IOException;

	/**
	 * Has InputStream reached EOF.
	 * @return
	 */
	public boolean isEof();

	/**
	 * Was there any conversion errors while decoding the InputStream.
	 * @return boolean indicating if conversion errors were encountered
	 */
	public boolean hasConversionError();

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy