Advertisement
fryc1906

projekt.currencyXMLFile

Jan 21st, 2016
307
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.72 KB | None | 0 0
  1. package bin;
  2. import java.net.*;
  3. import java.util.ArrayList;
  4. import java.util.List;
  5. import java.io.*;
  6.  
  7. public class CurrencyXMLFile {
  8.     private String xmlFileLoc;  //Lokalizacja pliku XML
  9.     private URL xmlURL;
  10.     private BufferedReader brFile;
  11.    
  12.    
  13.     public CurrencyXMLFile(String xmlFileLoc) throws Exception{
  14.         this.xmlFileLoc=xmlFileLoc;
  15.         openFile();
  16.     }
  17.     public CurrencyXMLFile(){
  18.        
  19.     }
  20.    
  21.     public BufferedReader getFile(){
  22.         return brFile;
  23.     }
  24.     public void closeFile() throws Exception{
  25.         if(brFile!=null){
  26.             brFile.close();
  27.         }
  28.     }
  29.    
  30.     public void openFile() throws Exception{
  31.         xmlURL=new URL(xmlFileLoc);
  32.         brFile=null;
  33.         brFile = new BufferedReader(new InputStreamReader(xmlURL.openStream()));   
  34.        
  35.        
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement