@Override public void write(Buffer source, long byteCount) throws IOException { super.write(source, byteCount); successfulCount += byteCount; } }
@Override public void write(Buffer source, long byteCount) throws IOException { super.write(source, byteCount); successfulCount += byteCount; } }
@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 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 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 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 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 write(Buffer source, long byteCount) throws IOException { try { super.write(source, byteCount); } catch (IOException e) { e.printStackTrace();
@Override public void write(Buffer source, long byteCount) { try { super.write(source, byteCount); } catch (Exception e) { ProgressHelper.dispatchErrorEvent(listeners, e); } if (totalBytes < 0) { totalBytes = contentLength(); } soFarBytes += byteCount; ProgressHelper.dispatchProgressEvent(listeners, soFarBytes, totalBytes); } }
@Override public void write(Buffer source, long byteCount) throws IOException { super.write(source, byteCount); bytesWritten += byteCount; if (listener != null) { listener.onProgress(bytesWritten); } } }
@Override public void write(Buffer source, long byteCount) throws IOException { super.write(source, byteCount); bytesWritten += byteCount; if (listener != null) { listener.onProgress(bytesWritten); } } }
@Override public void write(Buffer source, long byteCount) throws IOException { super.write(source, byteCount); bytesWritten += byteCount; listener.onRequestProgress(bytesWritten, contentLength()); }
@Override public void write(Buffer source, long byteCount) throws IOException { super.write(source, byteCount); if (contentLength == 0) { contentLength = contentLength(); } bytesWritten += byteCount; progressListener.onRequestProgress(bytesWritten, contentLength, bytesWritten == contentLength); } };
@Override public void write(Buffer source, long byteCount) throws IOException { super.write(source, byteCount); if (contentLength == 0) { contentLength = contentLength(); } bytesWritten += byteCount; progressListener.onRequestProgress(bytesWritten, contentLength, bytesWritten == contentLength); } };
@Override public void write(Buffer source, long byteCount) throws IOException { super.write(source, byteCount); if(contentLength == 0){ //获得contentLength的值,后续不再调用 contentLength = contentLength(); } //增加当前写入的字节数 bytesWritten += byteCount; callback.onLoading(contentLength,bytesWritten); } };
@Override public void write(Buffer source, long byteCount) throws IOException { super.write(source, byteCount); if (contentLength == 0) { contentLength = contentLength(); } bytesWritten += byteCount; progressListener.onRequestProgress(bytesWritten, contentLength, bytesWritten == contentLength); } };
@Override public void write(Buffer source, long byteCount) throws IOException { super.write(source, byteCount); if (contentLength == 0) { contentLength = contentLength(); } bytesWritten += byteCount; progressListener.onRequestProgress(bytesWritten, contentLength, bytesWritten == contentLength); } };
@Override public void write(Buffer source, long byteCount) throws IOException { super.write(source, byteCount); if (contentLength == 0) { contentLength = contentLength(); } bytesWritten += byteCount; progressListener.onRequestProgress(bytesWritten, contentLength, bytesWritten == contentLength); } };
@Override public void write(Buffer source, long byteCount) throws IOException { super.write(source, byteCount); bytesWritten += byteCount; listener.onRequestProgress(bytesWritten, contentLength()); } }
@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); } }