I'm trying to use a constant instead of a string literal in this piece of code:
new InputStreamReader(new FileInputStream(file), "UTF-8")
"UTF-8"
appears in the code rather often, and would be much better to refer to some static final
variable instead. Do you know where I can find such a variable in JDK?
BTW, on a second thought, such constants are bad design: Public Static Literals ... Are Not a Solution for Data Duplication
Files.newBufferedWriter(Path path, Charset cs)
from NIO. – Alchemist