1 /* 2 * $Id: StreamTransformer.java 22865 2011-09-05 17:23:45Z 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 import java.util.concurrent.atomic.AtomicLong; 15 16 /** 17 * A writer of {@link OutputStream} 18 */ 19 public interface StreamTransformer 20 { 21 /** 22 * Initialize this writer to write in the out OutputStream 23 * 24 * @param out the OutputStream where this writer is going to write information 25 * @throws Exception 26 */ 27 void initialize(OutputStream out) throws Exception; 28 29 /** 30 * Writes into out the number of bytes requested 31 * 32 * @param out the OutputStream where this writer is going to write information 33 * @param bytesRequested how many bytes this writer needs to write 34 * @return whether this writer has finished writing (no more bytes need to be written) 35 * @throws Exception 36 */ 37 boolean write(OutputStream out, AtomicLong bytesRequested) throws Exception; 38 }