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

com.darwinsys.io.ByteArrayDumpGetter Maven / Gradle / Ivy

There is a newer version: 1.8.0
Show newest version
package com.darwinsys.io;

/** A DumpSource that reads from an in-memory array of bytes */
public class ByteArrayDumpGetter implements DumpSource {

	private byte[] data;
	private int offset;
	private int max;
	
	/** Construct this object.
	 * @param d The data
	 */
	public ByteArrayDumpGetter(byte[] d) {
		data = d;
		offset = 0;
		max = data.length;
	}

	/** Retrieve the next value.
	 * @return The next value, or -1 when all done.
	 */
	public int get() {
		if (offset < max)
			return data[offset++];
		return -1;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy