feeddatasource.java
来自「编写rest实例 rest分布式框架在app中的应用」· Java 代码 · 共 47 行
JAVA
47 行
package com.jeffhanson.atompub.service;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import javax.activation.DataSource;
public class FeedDataSource
implements DataSource
{
private File file = null;
private String contentType = "";
public FeedDataSource(File file, String contentType)
{
this.file = file;
this.contentType = contentType;
}
public String getContentType()
{
return contentType;
}
public InputStream getInputStream()
throws IOException
{
return new FileInputStream(file);
}
public String getName()
{
return file.getName();
}
public OutputStream getOutputStream()
throws IOException
{
return new FileOutputStream(file);
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?