Logo Search packages:      
Sourcecode: javamorph version File versions  Download package

static void javamorph::CStrings::copyFile ( String  in,
String  out 
) [inline, static]

Copy one single file from the .jar distribution into the sub directory of the working directory.

Parameters:
in Location of the .jar file entry.
out Target path & name of the file to copy the content to.

Definition at line 164 of file CStrings.java.

Referenced by extractFiles().

                                                      {
        try{
            ClassLoader loader = ClassLoader.getSystemClassLoader();
            InputStream raw = loader.getResourceAsStream(in);
            BufferedInputStream bin = new BufferedInputStream(raw);
            BufferedOutputStream bout = 
                new BufferedOutputStream(new FileOutputStream(out));
            int i;
            while(-1 != (i = bin.read()))bout.write(i);
            bin.close();
            bout.close();
        }catch(Exception e){
            System.out.println("in = " + in + '.');
            System.out.println("out = " + out + '.');
            System.err.println(e.getMessage());
            System.out.println("in = " + in + '.');
            System.out.println("out = " + out + '.');
            e.printStackTrace();
            JOptionPane.showMessageDialog(null,
            "Can't copy file (" + out + "), see console output!");
        }           
    }


Generated by  Doxygen 1.6.0   Back to index