Skip to content

Instantly share code, notes, and snippets.

@gnosis23
Last active August 29, 2015 14:01
Show Gist options
  • Save gnosis23/2e0c17a9748c23889a8a to your computer and use it in GitHub Desktop.
Save gnosis23/2e0c17a9748c23889a8a to your computer and use it in GitHub Desktop.
encoding
public static void main(String[] args) throws Exception {
InputStream fis = app.class.getClassLoader().getResourceAsStream("input.txt");
InputStreamReader isr = new InputStreamReader(fis, "GBK");
Reader in = new BufferedReader(isr);
FileOutputStream fos = new FileOutputStream("D:/download/test.txt");
OutputStreamWriter osw = new OutputStreamWriter(fos, "UTF-8");
Writer out = new BufferedWriter(osw);
int ch;
while ((ch = in.read()) > -1) {
out.write(ch);
}
out.close();
in.close();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment