01: /*
02: * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//httpclient/src/java/org/apache/commons/httpclient/methods/multipart/PartSource.java,v 1.6 2004/04/18 23:51:37 jsdever Exp $
03: * $Revision: 480424 $
04: * $Date: 2006-11-29 06:56:49 +0100 (Wed, 29 Nov 2006) $
05: *
06: * ====================================================================
07: *
08: * Licensed to the Apache Software Foundation (ASF) under one or more
09: * contributor license agreements. See the NOTICE file distributed with
10: * this work for additional information regarding copyright ownership.
11: * The ASF licenses this file to You under the Apache License, Version 2.0
12: * (the "License"); you may not use this file except in compliance with
13: * the License. You may obtain a copy of the License at
14: *
15: * http://www.apache.org/licenses/LICENSE-2.0
16: *
17: * Unless required by applicable law or agreed to in writing, software
18: * distributed under the License is distributed on an "AS IS" BASIS,
19: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20: * See the License for the specific language governing permissions and
21: * limitations under the License.
22: * ====================================================================
23: *
24: * This software consists of voluntary contributions made by many
25: * individuals on behalf of the Apache Software Foundation. For more
26: * information on the Apache Software Foundation, please see
27: * <http://www.apache.org/>.
28: *
29: */
30:
31: package org.apache.commons.httpclient.methods.multipart;
32:
33: import java.io.IOException;
34: import java.io.InputStream;
35:
36: /**
37: * An interface for providing access to data when posting MultiPart messages.
38: *
39: * @see FilePart
40: *
41: * @author <a href="mailto:becke@u.washington.edu">Michael Becke</a>
42: *
43: * @since 2.0
44: */
45: public interface PartSource {
46:
47: /**
48: * Gets the number of bytes contained in this source.
49: *
50: * @return a value >= 0
51: */
52: long getLength();
53:
54: /**
55: * Gets the name of the file this source represents.
56: *
57: * @return the fileName used for posting a MultiPart file part
58: */
59: String getFileName();
60:
61: /**
62: * Gets a new InputStream for reading this source. This method can be
63: * called more than once and should therefore return a new stream every
64: * time.
65: *
66: * @return a new InputStream
67: *
68: * @throws IOException if an error occurs when creating the InputStream
69: */
70: InputStream createInputStream() throws IOException;
71:
72: }
|