|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
javax.activation Interface DataSource
- All Known Subinterfaces:
- MultipartDataSource
- All Known Implementing Classes:
- ByteArrayDataSource, FileDataSource, MimePartDataSource, URLDataSource
public interface DataSource
Implemented by:
ByteArrayDataSource, FileDataSource, MimePartDataSource, MultipartDataSource, URLDataSource
DataSource 接口为 JavaBeans Activation Framework 提供任意数据集合的抽象。它提供该数据的类型,并在适当的时候以
InputStream
和 OutputStream
的形式提供对该数据的访问。
The DataSource interface provides the JavaBeans Activation Framework
with an abstraction of an arbitrary collection of data. It
provides a type for that data as well as access
to it in the form of InputStreams
and
OutputStreams
where appropriate.
Method Summary | |
---|---|
String |
getContentType()
This method returns the MIME type of the data in the form of a string. |
InputStream |
getInputStream()
This method returns an InputStream representing
the data and throws the appropriate exception if it can
not do so. |
String |
getName()
Return the name of this object where the name of the object is dependant on the nature of the underlying objects. |
OutputStream |
getOutputStream()
This method returns an OutputStream where the
data can be written and throws the appropriate exception if it can
not do so. |
Method Detail |
---|
public java.io.InputStream
getInputStream() throws java.io.IOException
此方法返回一个表示数据的 InputStream
;如果无法提供,则抛出适当的异常。注意,每次调用此方法时都必须返回一个新的 InputStream
对象,并且流必须位于数据的开始位置。
return | InputStream |
getInputStream
InputStream getInputStream() throws IOException
- This method returns an
InputStream
representing the data and throws the appropriate exception if it can not do so. Note that a newInputStream
object must be returned each time this method is called, and the stream must be positioned at the beginning of the data. - Returns:
- an InputStream
- Throws:
IOException
public java.io.OutputStream
getOutputStream() throws java.io.IOException
此方法返回一个可以写入数据的 OutputStream
,如果无法返回,则抛出适当的异常。注意,每次调用此方法时都必须返回一个新的 OutputStream
对象,并且流必须位于要写入数据的位置。
return | OutputStream |
getOutputStream
OutputStream getOutputStream() throws IOException
- This method returns an
OutputStream
where the data can be written and throws the appropriate exception if it can not do so. Note that a newOutputStream
object must be returned each time this method is called, and the stream must be positioned at the location the data is to be written. - Returns:
- an OutputStream
- Throws:
IOException
public String
getContentType()
此方法以字符串形式返回数据的 MIME 类型。应该始终返回有效类型。如果 DataSource 实现不能确定数据类型,则建议 getContentType 返回 "application/octet-stream"。
return | MIME 类型 |
getContentType
String getContentType()
- This method returns the MIME type of the data in the form of a
string. It should always return a valid type. It is suggested
that getContentType return "application/octet-stream" if the
DataSource implementation can not determine the data type.
- Returns:
- the MIME Type
public String
getName()
返回此对象的名称,其中对象的名称依赖于底层对象的特性。封装文件的 DataSources 可以选择返回对象的文件名。(通常,这是文件名的最后部分,并不是完整路径名。)
return | 对象的名称。 |
getName
String getName()
- Return the name of this object where the name of the object
is dependant on the nature of the underlying objects. DataSources
encapsulating files may choose to return the filename of the object.
(Typically this would be the last component of the filename, not an
entire pathname.)
- Returns:
- the name of the object.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Submit a bug or feature
Copyright 2007 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.
PS : 未经我党受权你也可自由散发此文档。 如有任何错误请自行修正;若因此而造成任何损失请直接找人民主席,请勿与本人联系。谢谢!