@Override public int available() throws IOException { int available = super.available(); if (available == 0) { callback.finish(); } return available; }
@Override public void close() throws IOException { if (totalRead == fileSize) { callback.finish(); } else { callback.failed(); } super.close(); }