public Map<ICloud.MBSFile,Outcome> write(ByteString signature,IOFunction<OutputStream,Long> writer) throws IOException, InterruptedException {
  logger.trace("<< write() < signature: {}",Bytes.hex(signature));
  lock.lockInterruptibly();
  try {
    Map<ICloud.MBSFile,Outcome> outcomes=new HashMap<>();
    Set<ICloud.MBSFile> files=signatureToFileSet.remove(signature);
    if (files == null) {
      logger.warn("-- write() > unreferenced signature: {}",Bytes.hex(signature));
    }
 else {
      for (      ICloud.MBSFile file : files) {
        outcomes.put(file,cloudWriter.write(file,writer));
        outBytes.addAndGet(file.getSize());
      }
      logger.debug("-- write() > out: {} failed: {} total: {}",outBytes,failedBytes,totalBytes);
    }
    logger.trace(">> write()");
    return outcomes;
  }
  finally {
    lock.unlock();
  }
}

public Map < ICloud . MBSFile , Outcome > write ( ByteString signature , IOFunction < OutputStream , Long > writer ) throws IOException , InterruptedException { logger . trace ( "<< write() < signature: {}" , Bytes . hex ( signature ) ) ; lock . lockInterruptibly ( ) ; try { Map < ICloud . MBSFile , Outcome > outcomes = new HashMap < > ( ) ; Set < ICloud . MBSFile > files = signatureToFileSet . remove ( signature ) ; if ( files == null ) { logger . warn ( "-- write() > unreferenced signature: {}" , Bytes . hex ( signature ) ) ; } else { for ( ICloud . MBSFile file : files ) { outcomes . put ( file , cloudWriter . write ( file , writer ) ) ; outBytes . addAndGet ( file . getSize ( ) ) ; } logger . debug ( "-- write() > out: {} failed: {} total: {}" , outBytes , failedBytes , totalBytes ) ; } logger . trace ( ">> write()" ) ; return outcomes ; } finally { lock . unlock ( ) ; } }
writes the files referenced by the specified signature . < p > if encrypted , attempts to decrypt the file . optionally set ' s the last - modified timestamp . < p > the writer is not closed .
