Funkcja do wykorzystania w zadaniu drugim

static String readFile(String name, Charset charset){
   StringBuilder s = new StringBuilder();
   try( BufferedReader file = new BufferedReader(new InputStreamReader( new FileInputStream(name), charset))){
       for(;;){
           int c=file.read();
           if(c<0)break;
           s.append((char)c);
       }
       return s.toString();
   }
   catch (IOException ex) {
       ex.printStackTrace();
   }
   return "";
}
po/kolokwium_18.txt · Last modified: 2019/01/10 16:25 by pszwed
CC Attribution-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0