/** {@inheritDoc} */ @Override public int read() throws IOException { if (pos < maxLen) { int res = is.read(); if (res != -1) pos++; return res; } else return -1; }
/** {@inheritDoc} */ @Override public int read(@NotNull byte[] b, int off, int len) throws IOException { if (pos < maxLen) { len = (int)Math.min(len, maxLen - pos); int res = is.read(b, off, len); if (res != -1) pos += res; return res; } else return -1; }