⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 feeddatasource.java

📁 编写rest实例 rest分布式框架在app中的应用
💻 JAVA
字号:
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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -