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

com.gc.iotools.stream.store.Store Maven / Gradle / Ivy

Go to download

EasyStream is a small set of utilities for dealing with streams (InputStreams and OutputStreams). The aim is to ease the use of pipes when they're required. Main features are: * "Convert" an OutputStream to an InputStream. * Count the number of bytes read or wrote to a given stream. * While reading the data from an InputStream copy it to a supplied OutputStream. * Read the content of an InputStream multiple times or seek to a definite position

The newest version!
package com.gc.iotools.stream.store;

/*
 * Copyright (c) 2008, 2015 Gabriele Contini. This source code is released
 * under the BSD License.
 */

import java.io.IOException;

/**
 * Represent a place where bytes are memorized. Used in streams that need to
 * remember the data who was read.
 *
 * @author dvd.smnt
 * @since 1.2.0
 * @see com.gc.iotools.stream.is.RandomAccessInputStream
 * @version $Id: Store.java 576 2015-03-28 00:03:33Z gcontini $
 */
public interface Store {
	/**
	 * Cleans up the Store. Forget all the data previously stored.
	 */
	void cleanup();

	/**
	 * gets length bytes from the store.
	 *
	 * @param bytes
	 *            array where to put the data in.
	 * @param offset
	 *            offset in the array to start put the data.
	 * @param length
	 *            length of the bytes got from the store.
	 * @return number of bytes effectively put in the array or -1 if the Store
	 *         was empty.
	 * @throws java.io.IOException
	 *             when an error occurs in the store, and data can't be
	 *             retrieved.
	 */
	int get(byte[] bytes, int offset, int length) throws IOException;

	/**
	 * 

put

* * @param bytes an array of byte. * @param offset a int. * @param length a int. * @throws java.io.IOException if any. */ void put(byte[] bytes, int offset, int length) throws IOException; }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy