home *** CD-ROM | disk | FTP | other *** search
/ Sky at Night 2007 June / SAN CD 6-2007 CD-ROM 25.iso / pc / Software / AstroGrav_Win / Java / jre1.6.0 / lib / rt.jar / javax / activation / FileDataSource.class (.txt) < prev    next >
Encoding:
Java Class File  |  2006-11-29  |  1.1 KB  |  48 lines

  1. package javax.activation;
  2.  
  3. import java.io.File;
  4. import java.io.FileInputStream;
  5. import java.io.FileOutputStream;
  6. import java.io.IOException;
  7. import java.io.InputStream;
  8. import java.io.OutputStream;
  9.  
  10. public class FileDataSource implements DataSource {
  11.    private File _file;
  12.    private FileTypeMap typeMap;
  13.  
  14.    public FileDataSource(File var1) {
  15.       this._file = null;
  16.       this.typeMap = null;
  17.       this._file = var1;
  18.    }
  19.  
  20.    public FileDataSource(String var1) {
  21.       this(new File(var1));
  22.    }
  23.  
  24.    public InputStream getInputStream() throws IOException {
  25.       return new FileInputStream(this._file);
  26.    }
  27.  
  28.    public OutputStream getOutputStream() throws IOException {
  29.       return new FileOutputStream(this._file);
  30.    }
  31.  
  32.    public String getContentType() {
  33.       return this.typeMap == null ? FileTypeMap.getDefaultFileTypeMap().getContentType(this._file) : this.typeMap.getContentType(this._file);
  34.    }
  35.  
  36.    public String getName() {
  37.       return this._file.getName();
  38.    }
  39.  
  40.    public File getFile() {
  41.       return this._file;
  42.    }
  43.  
  44.    public void setFileTypeMap(FileTypeMap var1) {
  45.       this.typeMap = var1;
  46.    }
  47. }
  48.