thufir

UTF-8 how?

Jul 29th, 2014
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.78 KB | None | 0 0
  1. package net.bounceme.dur.client;
  2.  
  3. import java.io.BufferedInputStream;
  4. import java.io.IOException;
  5. import java.util.logging.Level;
  6. import java.util.logging.Logger;
  7.  
  8. public class Template {
  9.  
  10.     private static final Logger log = Logger.getLogger(Template.class.getName());
  11.  
  12.     public Template() {
  13.     }
  14.  
  15.     public void load() {
  16.         try (BufferedInputStream input = new BufferedInputStream(getClass().getClassLoader().getResourceAsStream("/template.txt"))) {
  17.             int data = input.read();
  18.             while (data != -1) {
  19.                 System.out.print((char) data);
  20.                 data = input.read();
  21.             }
  22.         } catch (IOException ex) {
  23.             Logger.getLogger(Template.class.getName()).log(Level.SEVERE, null, ex);
  24.         }
  25.     }
  26.  
  27. }
Advertisement
Add Comment
Please, Sign In to add comment