summaryrefslogtreecommitdiff
path: root/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/utils/FileUtils.java
diff options
context:
space:
mode:
Diffstat (limited to 'eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/utils/FileUtils.java')
-rw-r--r--eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/utils/FileUtils.java26
1 files changed, 13 insertions, 13 deletions
diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/utils/FileUtils.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/utils/FileUtils.java
index 16b0d321..fff83e53 100644
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/utils/FileUtils.java
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/utils/FileUtils.java
@@ -54,9 +54,9 @@ public class FileUtils {
* @throws IOException on any exception thrown
*/
public static byte[] readURL(String urlString) throws IOException {
- URL url = new URL(urlString);
- InputStream in = new BufferedInputStream(url.openStream());
- byte[] content = StreamUtils.readStream(in);
+ final URL url = new URL(urlString);
+ final InputStream in = new BufferedInputStream(url.openStream());
+ final byte[] content = StreamUtils.readStream(in);
in.close();
return content;
}
@@ -68,9 +68,9 @@ public class FileUtils {
* @throws IOException on any exception thrown
*/
public static byte[] readResource(String name) throws IOException {
- ClassLoader cl = FileUtils.class.getClassLoader();
- BufferedInputStream in = new BufferedInputStream(cl.getResourceAsStream(name));
- byte[] content = StreamUtils.readStream(in);
+ final ClassLoader cl = FileUtils.class.getClassLoader();
+ final BufferedInputStream in = new BufferedInputStream(cl.getResourceAsStream(name));
+ final byte[] content = StreamUtils.readStream(in);
in.close();
return content;
}
@@ -82,7 +82,7 @@ public class FileUtils {
* @throws IOException on any exception thrown
*/
public static String readResource(String name, String encoding) throws IOException {
- byte[] content = readResource(name);
+ final byte[] content = readResource(name);
return new String(content, encoding);
}
@@ -121,7 +121,7 @@ public class FileUtils {
if(null == url) return null;
- if (url.startsWith("http:/") || url.startsWith("https:/") || url.startsWith("file:/") || url.startsWith("ftp:/")) {
+ if (url.startsWith("http:") || url.startsWith("https:") || url.startsWith("file:") || url.startsWith("ftp:")) {
return url;
} else {
@@ -146,18 +146,18 @@ public class FileUtils {
{
try
{
- byte[] buffer = new byte[ 0xFFFF ];
+ final byte[] buffer = new byte[ 0xFFFF ];
for ( int len; (len = fis.read(buffer)) != -1; )
fos.write( buffer, 0, len );
}
- catch( IOException e ) {
+ catch( final IOException e ) {
System.err.println( e );
}
finally {
if ( fis != null )
- try { fis.close(); } catch ( IOException e ) { e.printStackTrace(); }
+ try { fis.close(); } catch ( final IOException e ) { e.printStackTrace(); }
if ( fos != null )
- try { fos.close(); } catch ( IOException e ) { e.printStackTrace(); }
+ try { fos.close(); } catch ( final IOException e ) { e.printStackTrace(); }
}
}
@@ -167,7 +167,7 @@ public class FileUtils {
{
copy( new FileInputStream( src ), new FileOutputStream( dest ) );
}
- catch( IOException e ) {
+ catch( final IOException e ) {
e.printStackTrace();
}
}