[
https://issues.apache.org/jira/browse/IO-342?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13430944#comment-13430944
]
Yaniv Kunda commented on IO-342:
--------------------------------
It might be useful to lazy-initialize the Charset, but in this case the
ByteOrderMark are fixed (i.e. almost all uses of this class is by using its
static instances) it's a small price to pay in sake of simplicity.
Also, the getAllSupported() method causes all charsets to be initialized, so it
would have to be lazy-initialized as well.
> Add getChartset/getBOMCharset methods to ByteOrderMark/BOMInputStream
> ---------------------------------------------------------------------
>
> Key: IO-342
> URL: https://issues.apache.org/jira/browse/IO-342
> Project: Commons IO
> Issue Type: Improvement
> Components: Utilities
> Reporter: Yaniv Kunda
> Priority: Minor
> Attachments: ByteOrderMark-charset.patch
>
>
> ByteOrderMark/BOMInputStream currently support getting the detected charset
> name via getCharsetName/getBOMCharsetName.
> Calling Charset.forName() is rather expensive, and its result should be fixed
> throughout the life of a JVM. Adding a cached copy of its result in
> ByteOrderMark will save callers of BOMInputStream.getBOMCharsetName this
> price.
> In case the JVM does not support the detected charset, the method can either
> throw the standard exception or return null.
--
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