FileHolder.java 734 Bytes
Newer Older
gzj34291's avatar
gzj34291 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
package com.hand.kinggrid;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;

public
class FileHolder {

    private String filename;

    private File file;

    private InputStream is ;

    public FileHolder(File file) {
        this.filename = file.getName();
        this.file = file;
    }

    public FileHolder(String filename , InputStream is) {
        this.filename = filename;
        this.is = is;
    }

    public InputStream getInputStream() throws FileNotFoundException{
        if(is == null){
            return new FileInputStream(file);
        }
        return is;
    }

    public String getFilename() {
        return filename;
    }


}