1 /**
2 *
3 * Copyright (C) 2011 Cloud Conscious, LLC. <info@cloudconscious.com>
4 *
5 * ====================================================================
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * 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, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 * ====================================================================
18 */
19 package org.jclouds.io;
20
21 import java.io.Closeable;
22 import java.io.InputStream;
23
24 import com.google.common.io.InputSupplier;
25
26 /**
27 * @author Adrian Cole
28 */
29 public interface Payload extends InputSupplier<InputStream>, WriteTo, Closeable {
30
31 /**
32 * Creates a new InputStream object of the payload.
33 */
34 InputStream getInput();
35
36 /**
37 * Payload in its original form.
38 */
39 Object getRawContent();
40
41 /**
42 * Tells if the payload is capable of producing its data more than once.
43 */
44 boolean isRepeatable();
45
46 /**
47 * release resources used by this entity. This should be called when data is discarded.
48 */
49 void release();
50
51 MutableContentMetadata getContentMetadata();
52
53 void setContentMetadata(MutableContentMetadata in);
54
55 }