protected void expandFile()

in src/main/org/apache/ant/compress/taskdefs/ExpandBase.java [102:126]


    protected void expandFile(FileUtils fileUtils, File srcF, File dir) {
        if (!srcF.exists()) {
            throw new BuildException("Unable to expand " + srcF
                                     + " as the file does not exist",
                                     getLocation());
        }
        InputStream is = null;
        try {
            is = StreamHelper.getInputStream(factory, new FileResource(srcF),
                                             getEncoding());
            if (is != null) {
                expandArchiveStream(srcF.getPath(), (ArchiveInputStream) is,
                                    dir);
            } else {
                is = new FileInputStream(srcF);
                expandStream(srcF.getPath(), is, dir);
            }
        } catch (IOException ioe) {
            throw new BuildException("Error while expanding " + srcF.getPath()
                                     + "\n" + ioe.toString(),
                                     ioe, getLocation());
        } finally {
            FileUtils.close(is);
        }
    }