1 | /**************************************************************** |
---|
2 | * Licensed to the Apache Software Foundation (ASF) under one * |
---|
3 | * or more contributor license agreements. See the NOTICE file * |
---|
4 | * distributed with this work for additional information * |
---|
5 | * regarding copyright ownership. The ASF licenses this file * |
---|
6 | * to you under the Apache License, Version 2.0 (the * |
---|
7 | * "License"); you may not use this file except in compliance * |
---|
8 | * with the License. You may obtain a copy of the License at * |
---|
9 | * * |
---|
10 | * http://www.apache.org/licenses/LICENSE-2.0 * |
---|
11 | * * |
---|
12 | * Unless required by applicable law or agreed to in writing, * |
---|
13 | * software distributed under the License is distributed on an * |
---|
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * |
---|
15 | * KIND, either express or implied. See the License for the * |
---|
16 | * specific language governing permissions and limitations * |
---|
17 | * under the License. * |
---|
18 | ****************************************************************/ |
---|
19 | |
---|
20 | package org.apache.james.mime4j.storage; |
---|
21 | |
---|
22 | import java.io.IOException; |
---|
23 | import java.io.InputStream; |
---|
24 | |
---|
25 | /** |
---|
26 | * Provides a strategy for storing the contents of an <code>InputStream</code> |
---|
27 | * or retrieving the content written to an <code>OutputStream</code>. |
---|
28 | */ |
---|
29 | public interface StorageProvider { |
---|
30 | /** |
---|
31 | * Stores the contents of the given <code>InputStream</code>. |
---|
32 | * |
---|
33 | * @param in stream containing the data to store. |
---|
34 | * @return a {@link Storage} instance that can be used to retrieve the |
---|
35 | * stored content. |
---|
36 | * @throws IOException if an I/O error occurs. |
---|
37 | */ |
---|
38 | Storage store(InputStream in) throws IOException; |
---|
39 | |
---|
40 | /** |
---|
41 | * Creates a {@link StorageOutputStream} where data to be stored can be |
---|
42 | * written to. Subsequently the user can call |
---|
43 | * {@link StorageOutputStream#toStorage() toStorage()} on that object to get |
---|
44 | * a {@link Storage} instance that holds the data that has been written. |
---|
45 | * |
---|
46 | * @return a {@link StorageOutputStream} where data can be written to. |
---|
47 | * @throws IOException |
---|
48 | * if an I/O error occurs. |
---|
49 | */ |
---|
50 | StorageOutputStream createStorageOutputStream() throws IOException; |
---|
51 | } |
---|