View Javadoc

1   /*
2    * $Id: TransformPolicy.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  /**
14   * A {@link TransformPolicy} represents a policy that controls how {@link StreamTransformer}
15   * transform {@link LazyTransformedInputStream}.
16   * 
17   * For instance, a policy would be transform all the bytes of the stream without waiting for some
18   * object to be requested. 
19   */
20  public interface TransformPolicy
21  {
22      /**
23       * Initialize this policy with the corresponding lazyTransformedInputStream
24       * 
25       * @param lazyTransformedInputStream
26       */
27      void initialize(LazyTransformedInputStream lazyTransformedInputStream);
28  
29      /**
30       * Releases all the resources of this policy
31       */
32      void release();
33  
34      /**
35       * Notifies this policy that the object has requested nroOfBytes
36       * 
37       * @param nroOfBytes the nro of bytes requested by the object
38       */
39      void readRequest(long nroOfBytes);
40  }
41  
42