commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Niall Pemberton (JIRA)" <>
Subject [jira] [Commented] (IO-337) ByteOrderMark can be refactored as an enum
Date Mon, 01 Jun 2015 19:20:19 GMT


Niall Pemberton commented on IO-337:

There are more byte order marks than the five defined as static variables in the ByteOrderMark
class. This way we just define the common ones, but allow people to construct others. Switching
to an enum would prevent this. It would also prevent the (ab)use of this class to detect starting
bytes such as the BOMInputStream does with the XML_GUESS_BYTES boms that it constructs.

> ByteOrderMark can be refactored as an enum
> ------------------------------------------
>                 Key: IO-337
>                 URL:
>             Project: Commons IO
>          Issue Type: New Feature
>            Reporter: Yaniv Kunda
>            Priority: Minor
>         Attachments: ByteOrderMark-enum.patch
> ByteOrderMark is used primarily for encapsulating the data regarding to Unicode BOMs.
Since those are fixed, it would make sense to make it an enum, instead of a public class.
> I have attached a patch that only covers ByteOrderMark itself, including an additional
getCharset() utility method, and toString() simplification.
> This patch does not cover:
> 1) Its incorrect use (per its perceived purpose) in XmlStreamReader.XML_GUESS_BYTES
> 2) The now-unnecessary tests

This message was sent by Atlassian JIRA

View raw message