1 /* 2 * $Id: OutputStreamWriter.java 20320 2010-11-24 15:03:31Z dfeist $ 3 * -------------------------------------------------------------------------------------- 4 * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com 5 * 6 * The software in this package is published under the terms of the CPAL v1.0 7 * license, a copy of which has been included with this distribution in the 8 * LICENSE.txt file. 9 */ 10 11 package org.mule.module.pgp; 12 13 import java.io.OutputStream; 14 15 import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicLong; 16 17 /** 18 * A writer of {@link OutputStream} 19 */ 20 public interface OutputStreamWriter 21 { 22 23 /** 24 * Initialize this writer to write in the out OutputStream 25 * 26 * @param out the OutputStream where this writer is going to write information 27 * @throws Exception 28 */ 29 void initialize(OutputStream out) throws Exception; 30 31 /** 32 * Writes into out the number of bytes requested 33 * 34 * @param out the OutputStream where this writer is going to write information 35 * @param bytesRequested how many bytes this writer needs to write 36 * @return whether this writer has finished writing (no more bytes need to be written 37 * @throws Exception 38 */ 39 boolean write(OutputStream out, AtomicLong bytesRequested) throws Exception; 40 }