[jira] [Commented] (IO-315) Replace all String encoding parameters with a value type

2012-04-10 Thread Aaron Digulla (Commented) (JIRA)

[ 
https://issues.apache.org/jira/browse/IO-315?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13251060#comment-13251060
 ] 

Aaron Digulla commented on IO-315:
--

@Sebb: Which is why I want a class that provides standard constants.

Just like Gary did in 
http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/Charsets.java?revision=1308315view=markup

 Replace all String encoding parameters with a value type
 --

 Key: IO-315
 URL: https://issues.apache.org/jira/browse/IO-315
 Project: Commons IO
  Issue Type: New Feature
  Components: Streams/Writers
Affects Versions: 2.1
Reporter: Aaron Digulla

 Please create an interface Encoding plus a set of useful defaults (UTF_8, 
 ISO_LATIN_1, CP_1250 and CP_1252).
 Use this interface in all places where String encoding is used now. This 
 would make the API more reliable, improve code reuse and reduce futile catch 
 blocks for {{UnsupportedEncodingException}}.

--
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




[jira] [Commented] (IO-315) Replace all String encoding parameters with a value type

2012-04-10 Thread Gary D. Gregory (Commented) (JIRA)

[ 
https://issues.apache.org/jira/browse/IO-315?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13251086#comment-13251086
 ] 

Gary D. Gregory commented on IO-315:


Such a class exists in IO trunk now. The vote to release 2.3 is underway.

Gary

 Replace all String encoding parameters with a value type
 --

 Key: IO-315
 URL: https://issues.apache.org/jira/browse/IO-315
 Project: Commons IO
  Issue Type: New Feature
  Components: Streams/Writers
Affects Versions: 2.1
Reporter: Aaron Digulla

 Please create an interface Encoding plus a set of useful defaults (UTF_8, 
 ISO_LATIN_1, CP_1250 and CP_1252).
 Use this interface in all places where String encoding is used now. This 
 would make the API more reliable, improve code reuse and reduce futile catch 
 blocks for {{UnsupportedEncodingException}}.

--
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




[jira] [Commented] (IO-315) Replace all String encoding parameters with a value type

2012-04-09 Thread Gary D. Gregory (Commented) (JIRA)

[ 
https://issues.apache.org/jira/browse/IO-315?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13249793#comment-13249793
 ] 

Gary D. Gregory commented on IO-315:


We now have a Charsets class in [codec].

 Replace all String encoding parameters with a value type
 --

 Key: IO-315
 URL: https://issues.apache.org/jira/browse/IO-315
 Project: Commons IO
  Issue Type: New Feature
  Components: Streams/Writers
Affects Versions: 2.1
Reporter: Aaron Digulla

 Please create an interface Encoding plus a set of useful defaults (UTF_8, 
 ISO_LATIN_1, CP_1250 and CP_1252).
 Use this interface in all places where String encoding is used now. This 
 would make the API more reliable, improve code reuse and reduce futile catch 
 blocks for {{UnsupportedEncodingException}}.

--
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




[jira] [Commented] (IO-315) Replace all String encoding parameters with a value type

2012-03-26 Thread Sebb (Commented) (JIRA)

[ 
https://issues.apache.org/jira/browse/IO-315?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13238278#comment-13238278
 ] 

Sebb commented on IO-315:
-

I don't think this is a good idea.
There are a lot of different encodings, and who is to say which ones are 
useful?
There would still need to be a way to use the String encoding to allow for 
encodings that are not provided by the interface.

Also, the code would still need to catch {{UnsupportedEncodingException}}.
As far as I know there is no requirement for a Java class-library to support 
any specific encodings, though it would be a fairly useless implementation that 
did not support UTF-8.

 Replace all String encoding parameters with a value type
 --

 Key: IO-315
 URL: https://issues.apache.org/jira/browse/IO-315
 Project: Commons IO
  Issue Type: New Feature
  Components: Streams/Writers
Affects Versions: 2.1
Reporter: Aaron Digulla

 Please create an interface Encoding plus a set of useful defaults (UTF_8, 
 ISO_LATIN_1, CP_1250 and CP_1252).
 Use this interface in all places where String encoding is used now. This 
 would make the API more reliable, improve code reuse and reduce futile catch 
 blocks for {{UnsupportedEncodingException}}.

--
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




[jira] [Commented] (IO-315) Replace all String encoding parameters with a value type

2012-03-26 Thread Gary D. Gregory (Commented) (JIRA)

[ 
https://issues.apache.org/jira/browse/IO-315?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13238371#comment-13238371
 ] 

Gary D. Gregory commented on IO-315:


There are six required encodings: 
http://docs.oracle.com/javase/6/docs/api/java/nio/charset/Charset.html

These are defined in a couple of Commons places:

- [lang]: org.apache.commons.lang3.CharEncoding
- [codec]: org.apache.commons.codec.CharEncoding

Gary

 Replace all String encoding parameters with a value type
 --

 Key: IO-315
 URL: https://issues.apache.org/jira/browse/IO-315
 Project: Commons IO
  Issue Type: New Feature
  Components: Streams/Writers
Affects Versions: 2.1
Reporter: Aaron Digulla

 Please create an interface Encoding plus a set of useful defaults (UTF_8, 
 ISO_LATIN_1, CP_1250 and CP_1252).
 Use this interface in all places where String encoding is used now. This 
 would make the API more reliable, improve code reuse and reduce futile catch 
 blocks for {{UnsupportedEncodingException}}.

--
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




[jira] [Commented] (IO-315) Replace all String encoding parameters with a value type

2012-03-26 Thread Sebb (Commented) (JIRA)

[ 
https://issues.apache.org/jira/browse/IO-315?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13238378#comment-13238378
 ] 

Sebb commented on IO-315:
-

Thanks for the list.
However, I don't think that makes a significant difference.

 Replace all String encoding parameters with a value type
 --

 Key: IO-315
 URL: https://issues.apache.org/jira/browse/IO-315
 Project: Commons IO
  Issue Type: New Feature
  Components: Streams/Writers
Affects Versions: 2.1
Reporter: Aaron Digulla

 Please create an interface Encoding plus a set of useful defaults (UTF_8, 
 ISO_LATIN_1, CP_1250 and CP_1252).
 Use this interface in all places where String encoding is used now. This 
 would make the API more reliable, improve code reuse and reduce futile catch 
 blocks for {{UnsupportedEncodingException}}.

--
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




[jira] [Commented] (IO-315) Replace all String encoding parameters with a value type

2012-03-26 Thread Aaron Digulla (Commented) (JIRA)

[ 
https://issues.apache.org/jira/browse/IO-315?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13238469#comment-13238469
 ] 

Aaron Digulla commented on IO-315:
--

My point is that everyone litters their code with string constants. String 
constants are bad for various reasons and APIs should not endorse them. In my 
own code, I use an interface so everyone can add more encodings if they need 
that but afterwards, I always know what is an encoding and what is text data 
(so no mixups like {{FileUtils.write(UTF-8, Hello, world)}}).

But I agree that commons IO is probably the wrong place to add them. Moving to 
commons-lang (which also contains code that handles the exception).

 Replace all String encoding parameters with a value type
 --

 Key: IO-315
 URL: https://issues.apache.org/jira/browse/IO-315
 Project: Commons IO
  Issue Type: New Feature
  Components: Streams/Writers
Affects Versions: 2.1
Reporter: Aaron Digulla

 Please create an interface Encoding plus a set of useful defaults (UTF_8, 
 ISO_LATIN_1, CP_1250 and CP_1252).
 Use this interface in all places where String encoding is used now. This 
 would make the API more reliable, improve code reuse and reduce futile catch 
 blocks for {{UnsupportedEncodingException}}.

--
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




[jira] [Commented] (IO-315) Replace all String encoding parameters with a value type

2012-03-26 Thread Aaron Digulla (Commented) (JIRA)

[ 
https://issues.apache.org/jira/browse/IO-315?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13238480#comment-13238480
 ] 

Aaron Digulla commented on IO-315:
--

If you don't like to add a new interface, how about supporting {{Charset}}? It 
doesn't throw a checked exception, for example and eventually, all the methods 
that accept string will have to lookup a {{Charset}}.

I'll try to convince commons-lang to convert the String constants to Charset 
constants (https://issues.apache.org/jira/browse/LANG-795)

 Replace all String encoding parameters with a value type
 --

 Key: IO-315
 URL: https://issues.apache.org/jira/browse/IO-315
 Project: Commons IO
  Issue Type: New Feature
  Components: Streams/Writers
Affects Versions: 2.1
Reporter: Aaron Digulla

 Please create an interface Encoding plus a set of useful defaults (UTF_8, 
 ISO_LATIN_1, CP_1250 and CP_1252).
 Use this interface in all places where String encoding is used now. This 
 would make the API more reliable, improve code reuse and reduce futile catch 
 blocks for {{UnsupportedEncodingException}}.

--
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




[jira] [Commented] (IO-315) Replace all String encoding parameters with a value type

2012-03-26 Thread Sebb (Commented) (JIRA)

[ 
https://issues.apache.org/jira/browse/IO-315?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13238598#comment-13238598
 ] 

Sebb commented on IO-315:
-

That makes a more sense now, but I think it would be overkill to introduce a 
new interface here.

Using Charset would be better IMO.

Using Charset would convert the checked {{UnsupportedEncodingException}} into 
the unchecked {{UnsupportedCharsetException}}.
This should simplify application code that does not already catch 
{{IOException}}, though of course in Commons IO many methods throw IOE already.

AFAICT, parameters would need to be changed to use (e.g.) 
{{Charset.forName(UTF-8)}} instead of {{UTF-8}} so user code would be 
slightly longer.

 Replace all String encoding parameters with a value type
 --

 Key: IO-315
 URL: https://issues.apache.org/jira/browse/IO-315
 Project: Commons IO
  Issue Type: New Feature
  Components: Streams/Writers
Affects Versions: 2.1
Reporter: Aaron Digulla

 Please create an interface Encoding plus a set of useful defaults (UTF_8, 
 ISO_LATIN_1, CP_1250 and CP_1252).
 Use this interface in all places where String encoding is used now. This 
 would make the API more reliable, improve code reuse and reduce futile catch 
 blocks for {{UnsupportedEncodingException}}.

--
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




[jira] [Commented] (IO-315) Replace all String encoding parameters with a value type

2012-03-26 Thread Gary D. Gregory (Commented) (JIRA)

[ 
https://issues.apache.org/jira/browse/IO-315?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13238635#comment-13238635
 ] 

Gary D. Gregory commented on IO-315:


FYI: I'm experimenting with a Charsets constant class in [codec] now (not 
committed). 

 Replace all String encoding parameters with a value type
 --

 Key: IO-315
 URL: https://issues.apache.org/jira/browse/IO-315
 Project: Commons IO
  Issue Type: New Feature
  Components: Streams/Writers
Affects Versions: 2.1
Reporter: Aaron Digulla

 Please create an interface Encoding plus a set of useful defaults (UTF_8, 
 ISO_LATIN_1, CP_1250 and CP_1252).
 Use this interface in all places where String encoding is used now. This 
 would make the API more reliable, improve code reuse and reduce futile catch 
 blocks for {{UnsupportedEncodingException}}.

--
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