1 package jp.sf.grizzly.storage;
2
3 import java.io.InputStream;
4 import java.io.OutputStream;
5
6 public interface StreamStorage
7 {
8 /***
9 * Initialize this StreamStorage object.
10 *
11 * @param in an input stream that you want to convert
12 * @param encoding an encoding for the given input stream
13 * @throws StreamStorageException
14 */
15 public abstract void init(InputStream in, String encoding)
16 throws StreamStorageException;
17
18 /***
19 * Destroys instances, such as caches, in this class
20 */
21 public abstract void destroy();
22
23 /***
24 * Commits a written output stream, and then you can get the commited
25 * stream from getInputStream().
26 *
27 * @throws StreamStorageException
28 */
29 public abstract void commit() throws StreamStorageException;
30
31 /***
32 * @return Returns the converted byte stream.
33 * @throws StreamStorageException
34 */
35 public abstract InputStream getResultInputStream()
36 throws StreamStorageException;
37
38 /***
39 * @return Returns the encoding.
40 */
41 public abstract String getEncoding();
42
43 /***
44 * @return Returns the inputStream.
45 */
46 public abstract InputStream getInputStream();
47
48 /***
49 * @return Returns the outputStream.
50 */
51 public abstract OutputStream getOutputStream();
52 }