attachmentdatasource.java

来自「Jive是基于JSP/JAVA技术构架的一个大型BBS论坛系统,这是Jive论坛」· Java 代码 · 共 66 行

JAVA
66
字号
/** * $RCSfile: AttachmentDataSource.java,v $ * $Revision: 1.2 $ * $Date: 2002/03/08 03:41:08 $ * * Copyright (C) 1999-2002 CoolServlets, Inc. All rights reserved. * * This software is the proprietary information of CoolServlets, Inc. * Use is subject to license terms. */package com.jivesoftware.forum.gateway;import com.jivesoftware.forum.Attachment;import java.io.IOException;import javax.activation.DataSource;/** * Provides a datasource wrapper for an Attachment object. * * @author  Bruce Ritchie */public class AttachmentDataSource implements DataSource {    private Attachment attachment;    /**     * Constructor     */    public AttachmentDataSource(Attachment attachment) throws IOException {        super();        this.attachment = attachment;    }    public java.io.OutputStream getOutputStream() throws java.io.IOException {        throw new IOException("AttachmentDataSource does not support getOutputStream()");    }    /**     * Returns an input stream of the request data     *     * @throws IOException if an error occurs reading from the underlying InputStream     * @return an input stream     */    public java.io.InputStream getInputStream() throws java.io.IOException {        return attachment.getData();    }    /**     * Returns the name of the attachment     *     * @return name the ip of the remote user     */    public String getName() {        return attachment.getName();    }    /**     * Return the content type associated with the request     *     * @return contentType     */    public String getContentType() {        return attachment.getContentType();    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?