thufir

Untitled

Jul 29th, 2014
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.90 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.     StringBuffer buffer = new StringBuffer();
  12.  
  13.     public Template() {
  14.     }
  15.  
  16.     public String getTemplate() {
  17.         return buffer.toString();
  18.     }
  19.  
  20.     public void load() {
  21.         try (BufferedInputStream input = new BufferedInputStream(getClass().getClassLoader().getResourceAsStream("template.txt"))) {
  22.             int data = input.read();
  23.             while (data != -1) {
  24.                 buffer.append((char) data);
  25.                 data = input.read();
  26.             }
  27.         } catch (IOException ex) {
  28.             Logger.getLogger(Template.class.getName()).log(Level.SEVERE, null, ex);
  29.         }
  30.     }
  31.  
  32. }
Advertisement
Add Comment
Please, Sign In to add comment