com.darwinsys.io.ByteArrayDumpGetter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of darwinsys-api Show documentation
Show all versions of darwinsys-api Show documentation
Ian Darwin's assorted Java stuff,
assembled as an API.
package com.darwinsys.io;
/** A Getter that reads from an in-memory array of bytes */
public class ByteArrayDumpGetter implements DumpSource {
private byte[] data;
private int offset;
private int max;
public ByteArrayDumpGetter(byte[] d) {
data = d;
offset = 0;
max = data.length;
}
public int get() {
if (offset < max)
return data[offset++];
return -1;
}
}