public long skip(long n) throws IOException { long t = 0; while (current != null && n > 0) { if (current instanceof ByteDataStep) { final ByteDataStep step = (ByteDataStep) current; final byte[] bytes = step.getBytes(); final int blen = bytes.length; if (idx == blen) { current = steps.poll(); idx = 0; } else { final int c = (int) Math.min((long) blen - idx, n); idx += c; n -= c; if (idx == blen) { current = steps.poll(); idx = 0; } } } else { // an object is pending return t; } } return t; }
public int read(final byte[] b, int off, int len) throws IOException { if (len == 0) return 0; int t = 0; while (current != null && len > 0) { if (current instanceof ByteDataStep) { final ByteDataStep step = (ByteDataStep) current; final byte[] bytes = step.getBytes(); final int blen = bytes.length; if (idx == blen) { current = steps.poll(); idx = 0; } else { final int c = Math.min(blen - idx, len); System.arraycopy(bytes, idx, b, off, c); idx += c; off += c; len -= c; t += c; if (idx == blen) { current = steps.poll(); idx = 0; } } } else { // an object is pending return t == 0 ? -1 : t; } } return t == 0 ? -1 : t; }
public int read() throws IOException { while (current != null) { if (current instanceof ByteDataStep) { final ByteDataStep step = (ByteDataStep) current; final byte[] bytes = step.getBytes(); if (idx == bytes.length) { current = steps.poll(); idx = 0; } else { final byte b = bytes[idx++]; return b & 0xff; } } else { // an object is pending return -1; } } return -1; }
public long skip(long n) throws IOException { long t = 0; while (current != null && n > 0) { if (current instanceof ByteDataStep) { final ByteDataStep step = (ByteDataStep) current; final byte[] bytes = step.getBytes(); final int blen = bytes.length; if (idx == blen) { current = steps.poll(); idx = 0; } else { final int c = (int) Math.min((long) blen - idx, n); idx += c; n -= c; if (idx == blen) { current = steps.poll(); idx = 0; } } } else { // an object is pending return t; } } return t; }
public int read(final byte[] b, int off, int len) throws IOException { if (len == 0) return 0; int t = 0; while (current != null && len > 0) { if (current instanceof ByteDataStep) { final ByteDataStep step = (ByteDataStep) current; final byte[] bytes = step.getBytes(); final int blen = bytes.length; if (idx == blen) { current = steps.poll(); idx = 0; } else { final int c = Math.min(blen - idx, len); System.arraycopy(bytes, idx, b, off, c); idx += c; off += c; len -= c; t += c; if (idx == blen) { current = steps.poll(); idx = 0; } } } else { // an object is pending return t == 0 ? -1 : t; } } return t == 0 ? -1 : t; }
public long skip(long n) throws IOException { long t = 0; while (current != null && n > 0) { if (current instanceof ByteDataStep) { final ByteDataStep step = (ByteDataStep) current; final byte[] bytes = step.getBytes(); final int blen = bytes.length; if (idx == blen) { current = steps.poll(); idx = 0; } else { final int c = (int) Math.min((long) blen - idx, n); idx += c; n -= c; if (idx == blen) { current = steps.poll(); idx = 0; } } } else { // an object is pending return t; } } return t; }
public long skip(long n) throws IOException { long t = 0; while (current != null && n > 0) { if (current instanceof ByteDataStep) { final ByteDataStep step = (ByteDataStep) current; final byte[] bytes = step.getBytes(); final int blen = bytes.length; if (idx == blen) { current = steps.poll(); idx = 0; } else { final int c = (int) Math.min((long) blen - idx, n); idx += c; n -= c; if (idx == blen) { current = steps.poll(); idx = 0; } } } else { // an object is pending return t; } } return t; }
public long skip(long n) throws IOException { long t = 0; while (current != null && n > 0) { if (current instanceof ByteDataStep) { final ByteDataStep step = (ByteDataStep) current; final byte[] bytes = step.getBytes(); final int blen = bytes.length; if (idx == blen) { current = steps.poll(); idx = 0; } else { final int c = (int) Math.min((long) blen - idx, n); idx += c; n -= c; if (idx == blen) { current = steps.poll(); idx = 0; } } } else { // an object is pending return t; } } return t; }
public long skip(long n) throws IOException { long t = 0; while (current != null && n > 0) { if (current instanceof ByteDataStep) { final ByteDataStep step = (ByteDataStep) current; final byte[] bytes = step.getBytes(); final int blen = bytes.length; if (idx == blen) { current = steps.poll(); idx = 0; } else { final int c = (int) Math.min((long) blen - idx, n); idx += c; n -= c; if (idx == blen) { current = steps.poll(); idx = 0; } } } else { // an object is pending return t; } } return t; }
public int read() throws IOException { while (current != null) { if (current instanceof ByteDataStep) { final ByteDataStep step = (ByteDataStep) current; final byte[] bytes = step.getBytes(); if (idx == bytes.length) { current = steps.poll(); idx = 0; } else { final byte b = bytes[idx++]; return b & 0xff; } } else { // an object is pending return -1; } } return -1; }
public int read() throws IOException { while (current != null) { if (current instanceof ByteDataStep) { final ByteDataStep step = (ByteDataStep) current; final byte[] bytes = step.getBytes(); if (idx == bytes.length) { current = steps.poll(); idx = 0; } else { final byte b = bytes[idx++]; return b & 0xff; } } else { // an object is pending return -1; } } return -1; }
public int read() throws IOException { while (current != null) { if (current instanceof ByteDataStep) { final ByteDataStep step = (ByteDataStep) current; final byte[] bytes = step.getBytes(); if (idx == bytes.length) { current = steps.poll(); idx = 0; } else { final byte b = bytes[idx++]; return b & 0xff; } } else { // an object is pending return -1; } } return -1; }
public int read() throws IOException { while (current != null) { if (current instanceof ByteDataStep) { final ByteDataStep step = (ByteDataStep) current; final byte[] bytes = step.getBytes(); if (idx == bytes.length) { current = steps.poll(); idx = 0; } else { final byte b = bytes[idx++]; return b & 0xff; } } else { // an object is pending return -1; } } return -1; }
public int read() throws IOException { while (current != null) { if (current instanceof ByteDataStep) { final ByteDataStep step = (ByteDataStep) current; final byte[] bytes = step.getBytes(); if (idx == bytes.length) { current = steps.poll(); idx = 0; } else { final byte b = bytes[idx++]; return b & 0xff; } } else { // an object is pending return -1; } } return -1; }
public int available() throws IOException { return current instanceof ByteDataStep ? ((ByteDataStep) current).getBytes().length - idx : 0; }
public int available() throws IOException { return current instanceof ByteDataStep ? ((ByteDataStep) current).getBytes().length - idx : 0; }
public int available() throws IOException { return current instanceof ByteDataStep ? ((ByteDataStep) current).getBytes().length - idx : 0; }
public int available() throws IOException { return current instanceof ByteDataStep ? ((ByteDataStep) current).getBytes().length - idx : 0; }
public int available() throws IOException { return current instanceof ByteDataStep ? ((ByteDataStep) current).getBytes().length - idx : 0; }
public int available() throws IOException { return current instanceof ByteDataStep ? ((ByteDataStep) current).getBytes().length - idx : 0; }