commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stephen Colebourne" <>
Subject [io] Deprecate CopyUtils
Date Sat, 31 Jul 2004 11:57:10 GMT
I have been looking at adding methods to IOUtils/CopyUtils, to handle
additional types and to fix some holes.

The net result is a realisation that the CopyUtils class was a poor creation
(and it may even have been my idea!).

- CopyUtils implements various methods that write byte[] and String to
stream/writer but to this inefficiently via other writers/streams.
- null handling is unclear.
- the toXxx methods on IOUtils are strongly related to CopyUtils yet they
are on a different class (they are the read() operations)
- it is not logical to look on a 'copy' class to find a method when I just
want to 'write' data (write a string/byte[] to file is not a copy operation
in most peoples minds.)

So, I propose the following:
CopyUtils deprecated, methods moved to IOUtils.

Write methods (string/byte[] to stream) are renamed to write(...)
Copy methods (stream to stream) stay named as copy(...)

The write methods will also change implementation to handle null
string/byte[] and to be more efficient.

The main downside is that it annoys users who are using CopyUtils. However,
it does seem to be better to fix the issue and get the right API.

Alternatives would include ReaderUtils, WriterUtils, InputStreamUtils,
OutputStreamUtils, but then where do the actual copy methods go. Plus too
much breaking up can be troublesome for users too. This strategy of IOUtils
for low level streams/readers/writers and FileUtils for higher level files
and FilenameUtils for even higher level seems to work well in my mind.

If there are no objections I will commit these changes....


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message