[
https://issues.apache.org/jira/browse/CAMEL-5235?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13265720#comment-13265720
]
Babak Vahdat commented on CAMEL-5235:
-------------------------------------
Claus, one stupid question of mine:
Why don't we simply remove these two static member classes EncodingFileReader
as well as EncodingFileWriter and just make use of JDK's own InputStreamReader
& OutputStreamWriter directly? To my understanding these two classes provide no
added value other than trouble. And the JDK's own bridges (byte streams to
character streams) are already *encoding aware* anyway!
So the two usage methods would simply become:
{code}
public static BufferedReader toReader(File file, String charset) throws
IOException {
FileInputStream in = new FileInputStream(file);
return IOHelper.buffered(new InputStreamReader(in, charset));
}
{code}
{code}
public static BufferedWriter toWriter(File file, boolean append, String
charset) throws IOException {
FileOutputStream os = new FileOutputStream(file, append);
return IOHelper.buffered(new OutputStreamWriter(os, charset));
}
{code}
They were both introduced by CAMEL-2056.
> Make sure to close file input stream when converting file to string to avoid
> locking file on windows
> ----------------------------------------------------------------------------------------------------
>
> Key: CAMEL-5235
> URL: https://issues.apache.org/jira/browse/CAMEL-5235
> Project: Camel
> Issue Type: Bug
> Components: camel-core
> Affects Versions: 2.9.2
> Reporter: Claus Ibsen
> Assignee: Claus Ibsen
> Fix For: 2.9.3, 2.10.0
>
>
> See nabble
> http://camel.465427.n5.nabble.com/File-Processor-Not-deleting-the-files-tp5670301.html
> Need to explicit close the file input/output streams to avoid the files to be
> locked on windows.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira