@Override public void write(Buffer source, long byteCount) throws IOException { super.write(source, byteCount); successfulCount += byteCount; } }
@Override public void close() throws IOException { openSinks.remove(sink); super.close(); } };
@Override public void flush() throws IOException { if (hasErrors) return; try { super.flush(); } catch (IOException e) { hasErrors = true; onException(e); } }
@Override public void write(Buffer source, long byteCount) throws IOException { super.write(source, byteCount); successfulCount += byteCount; } }
@Override public void close() throws IOException { synchronized (Cache.this) { if (done) { return; } done = true; writeSuccessCount++; } super.close(); editor.commit(); } };
@Override public void flush() throws IOException { if (hasErrors) return; try { super.flush(); } catch (IOException e) { hasErrors = true; onException(e); } }
@Override public void write(Buffer source, long byteCount) throws IOException { if (hasErrors) { source.skip(byteCount); return; } try { super.write(source, byteCount); } catch (IOException e) { hasErrors = true; onException(e); } }
@Override public void close() throws IOException { if (hasErrors) return; try { super.close(); } catch (IOException e) { hasErrors = true; onException(e); } }
@Override public void flush() throws IOException { if (failed) return; try { super.flush(); } catch (Exception e) { failed = true; onException(e); } }
@Override public void write(Buffer source, long byteCount) throws IOException { if (failed) return; try { super.write(source, byteCount); } catch (Exception e) { failed = true; onException(e); } }
@Override public void close() throws IOException { if (hasErrors) return; try { super.close(); } catch (IOException e) { hasErrors = true; onException(e); } }
@Override public void flush() throws IOException { if (hasErrors) return; try { super.flush(); } catch (IOException e) { hasErrors = true; onException(e); } }
@Override public void write(Buffer source, long byteCount) throws IOException { if (hasErrors) { source.skip(byteCount); return; } try { super.write(source, byteCount); } catch (IOException e) { hasErrors = true; onException(e); } }
@Override public void close() throws IOException { synchronized (Cache.this) { if (done) { return; } done = true; writeSuccessCount++; } super.close(); editor.commit(); } };
@Override public void flush() throws IOException { if (hasErrors) return; try { super.flush(); } catch (IOException e) { hasErrors = true; onException(e); } }
@Override public void write(Buffer source, long byteCount) throws IOException { super.write(source, byteCount); if (contentLength == 0) { contentLength = contentLength(); } bytesWritten += byteCount; if (uploadProgressHandler != null) { uploadProgressHandler.obtainMessage(ANConstants.UPDATE, new Progress(bytesWritten, contentLength)).sendToTarget(); } } };
@Override public void close() throws IOException { if (failed) return; try { super.close(); } catch (Exception e) { failed = true; onException(e); } }
@Override public void flush() throws IOException { if (hasErrors) return; try { super.flush(); } catch (IOException e) { hasErrors = true; onException(e); } }
@Override public void write(Buffer source, long byteCount) throws IOException { if (byteCount < 0) throw new IllegalArgumentException("byteCount < 0: " + byteCount); if (source.size() < byteCount) { throw new IllegalArgumentException("size=" + source.size() + " byteCount=" + byteCount); } if (byteCount == 0) return; source.readUnsafe(cursor); try { long remaining = byteCount; for (int length = cursor.seek(0); remaining > 0 && length > 0; length = cursor.next()) { int toIntercept = (int) Math.min(length, remaining); intercept(cursor.data, cursor.start, toIntercept); remaining -= toIntercept; } } finally { cursor.close(); } super.write(source, byteCount); }
@Override public void close() throws IOException { super.close(); }