Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
1.5.7, 1.6-rc-2, 1.7.0
-
None
-
Patch
Description
Currently, the DGM method File.append() only works for text data. File.append(Object) can technically accept an InputStream, but it assumes that both the streaming data and the output file are using the platform-default character encoding. In any other case, the data will be mangled.
I propose creating a method File.append(InputStream) which will basically delegate to InputStream.leftShift(InputStream). This maintains backward-compatibility since all InputStreams that happen to be text will be piped through un-interpreted, which AFAIK would be identical to the current behavior of reading the stream and writing it back out using the same encoding. But in this case, if the source data is binary or happens to have an encoding that is not the platform default, it will not get mashed by a reader using the incorrect encoding. Patch is attached.