edu.iris.dmc.seed.io.Buf Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of java-4-seed Show documentation
Show all versions of java-4-seed Show documentation
Java API to work with seismic dataless seed
The newest version!
package edu.iris.dmc.seed.io;
public class Buf {
private byte[] bytes;
private int count;
private Buf(int size) {
this.bytes = new byte[size];
}
public void append(byte[] b) {
append(b, 0, b.length);
}
public void append(byte[] b, int offset, int numberOfBytes) {
System.arraycopy(b, offset, bytes, count, numberOfBytes);
count += b.length;
}
public void reset(byte[] bytes) {
count = 0;
append(bytes);
}
public int length() {
return this.bytes.length;
}
public int available() {
return bytes.length - count;
}
// public byte[] getBytes() {
// return this.bytes;
// }
public byte[] flush() {
for (int i = count; i < bytes.length; i++) {
bytes[i] = ' ';
}
count = 0;
return bytes;
}
public static Buf of(int size) {
return new Buf(size);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy