first commit
This commit is contained in:
commit
4d332ef662
27586 changed files with 3281783 additions and 0 deletions
|
|
@ -0,0 +1,48 @@
|
|||
package javax.activation;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
public class FileDataSource implements DataSource {
|
||||
private File _file = null;
|
||||
|
||||
private FileTypeMap typeMap = null;
|
||||
|
||||
public FileDataSource(File paramFile) {
|
||||
this._file = paramFile;
|
||||
}
|
||||
|
||||
public FileDataSource(String paramString) {
|
||||
this(new File(paramString));
|
||||
}
|
||||
|
||||
public InputStream getInputStream() throws IOException {
|
||||
return new FileInputStream(this._file);
|
||||
}
|
||||
|
||||
public OutputStream getOutputStream() throws IOException {
|
||||
return new FileOutputStream(this._file);
|
||||
}
|
||||
|
||||
public String getContentType() {
|
||||
if (this.typeMap == null)
|
||||
return FileTypeMap.getDefaultFileTypeMap().getContentType(this._file);
|
||||
return this.typeMap.getContentType(this._file);
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this._file.getName();
|
||||
}
|
||||
|
||||
public File getFile() {
|
||||
return this._file;
|
||||
}
|
||||
|
||||
public void setFileTypeMap(FileTypeMap paramFileTypeMap) {
|
||||
this.typeMap = paramFileTypeMap;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue