X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Futils%2FIOUtils.java;h=e7ab4033a8e15933ee6b38673a57efb6f074feb6;hb=943bdec257922347428f44df32547fd4f5a57931;hp=9ab638af06e1486122de1c059abec3eb5b0a4980;hpb=028ff7c29a8fb07c702ffd34913a5dd22b688211;p=nikiroo-utils.git diff --git a/src/be/nikiroo/utils/IOUtils.java b/src/be/nikiroo/utils/IOUtils.java index 9ab638a..e7ab403 100644 --- a/src/be/nikiroo/utils/IOUtils.java +++ b/src/be/nikiroo/utils/IOUtils.java @@ -232,7 +232,7 @@ public class IOUtils { throws IOException { FileOutputStream out = new FileOutputStream(file); try { - out.write(content.getBytes("UTF-8")); + out.write(StringUtils.getBytes(content)); } finally { out.close(); } @@ -275,8 +275,7 @@ public class IOUtils { write(stream, out); return out.toString("UTF-8"); } finally { - // do NOT close, or the related stream will be closed, too - // out.close(); + out.close(); } } @@ -410,19 +409,11 @@ public class IOUtils { write(in, tmp); in.close(); - final FileInputStream fis = new FileInputStream(tmp); - return new MarkableFileInputStream(fis) { + return new MarkableFileInputStream(tmp) { @Override public void close() throws IOException { try { - try { - super.close(); - } finally { - try { - fis.close(); - } catch (IOException e) { - } - } + super.close(); } finally { tmp.delete(); }