View Javadoc

1   package org.treetank.io.bytepipe;
2   
3   import java.io.InputStream;
4   import java.io.OutputStream;
5   
6   import org.treetank.exception.TTByteHandleException;
7   
8   import com.google.inject.ImplementedBy;
9   
10  /**
11   * Interface for the decorator, representing any byte representation to be
12   * serialized or to serialize.
13   * 
14   * @author Sebastian Graf, University of Konstanz
15   * 
16   */
17  @ImplementedBy(ByteHandlerPipeline.class)
18  public interface IByteHandler extends Cloneable {
19  
20      /**
21       * Method to serialize any byte-chunk.
22       * 
23       * @param pToSerialize
24       *            byte to be serialized
25       * @return outputstream from the pipeline
26       * @throws TTByteHandleException
27       *             to be capsulated.
28       */
29      OutputStream serialize(OutputStream pToSerialize) throws TTByteHandleException;
30  
31      /**
32       * Method to deserialize any byte-chunk.
33       * 
34       * @param pToDeserialize
35       *            to deserialize
36       * @return the inputstream from the pipeline
37       * @throws TTByteHandleException
38       *             to be capsulated.
39       */
40      InputStream deserialize(InputStream pToDeserialize) throws TTByteHandleException;
41  
42      /**
43       * Defining the cloning operation
44       * 
45       * @return a clone of the current {@link IByteHandler}-instance.
46       */
47      IByteHandler clone();
48  
49      /**
50       * Concartenating interface for offering dedicated access to {@link ByteHandlerPipeline} for injections.
51       * 
52       * @author Sebastian Graf, University of Konstanz
53       * 
54       */
55      public interface IByteHandlerPipeline extends IByteHandler, Iterable<IByteHandler> {
56  
57          /**
58           * Defining the cloning operation
59           * 
60           * @return a clone of the current {@link IByteHandler}-instance.
61           */
62          IByteHandlerPipeline clone();
63  
64      }
65  
66  }