private void writeToCache(final byte[] b, final int off, int count) { if (!this.overflow && count > 0) { if (contentCacheLimit != null && count + cachedContent.size() > contentCacheLimit) { this.overflow = true; cachedContent.write(b, off, contentCacheLimit - cachedContent.size()); handleContentOverflow(contentCacheLimit); return; } cachedContent.write(b, off, count); } }
@Override public int read() throws IOException { int ch = this.is.read(); if (ch != -1 && !this.overflow) { if (contentCacheLimit != null && cachedContent.size() == contentCacheLimit) { this.overflow = true; handleContentOverflow(contentCacheLimit); } else { cachedContent.write(ch); } } return ch; }
private void writeToCache(final byte[] b, final int off, int count) { if (!this.overflow && count > 0) { if (contentCacheLimit != null && count + cachedContent.size() > contentCacheLimit) { this.overflow = true; cachedContent.write(b, off, contentCacheLimit - cachedContent.size()); handleContentOverflow(contentCacheLimit); return; } cachedContent.write(b, off, count); } }
@Override public int read() throws IOException { int ch = this.is.read(); if (ch != -1 && !this.overflow) { if (contentCacheLimit != null && cachedContent.size() == contentCacheLimit) { this.overflow = true; handleContentOverflow(contentCacheLimit); } else { cachedContent.write(ch); } } return ch; }
private void writeToCache(final byte[] b, final int off, int count) { if (!this.overflow && count > 0) { if (contentCacheLimit != null && count + cachedContent.size() > contentCacheLimit) { this.overflow = true; cachedContent.write(b, off, contentCacheLimit - cachedContent.size()); handleContentOverflow(contentCacheLimit); return; } cachedContent.write(b, off, count); } }
@Override public int read() throws IOException { int ch = this.is.read(); if (ch != -1 && !this.overflow) { if (contentCacheLimit != null && cachedContent.size() == contentCacheLimit) { this.overflow = true; handleContentOverflow(contentCacheLimit); } else { cachedContent.write(ch); } } return ch; }
@Override public int read() throws IOException { int ch = this.is.read(); if (ch != -1 && !this.overflow) { if (contentCacheLimit != null && cachedContent.size() == contentCacheLimit) { this.overflow = true; handleContentOverflow(contentCacheLimit); } else { cachedContent.write(ch); } } return ch; }