public InputBuffer(Input in, long position) throws IOException { this.in = in; this.inLength = in.length(); this.offset = position; if (in instanceof InputBytes) { // use buffer directly this.buf = ((InputBytes)in).getBuffer(); this.limit = (int)in.length(); this.offset = limit; this.pos = (int)position; } else { // create new buffer this.buf = new byte[8192]; // big enough for primitives } }
public InputBuffer(Input in, long position) throws IOException { this.in = in; this.inLength = in.length(); this.offset = position; if (in instanceof InputBytes) { // use buffer directly this.buf = ((InputBytes)in).getBuffer(); this.limit = (int)in.length(); this.offset = limit; } else { // create new buffer this.buf = new byte[8192]; // big enough for primitives } }