private byte[] getBytes(String name) { try{ File f = new TFile(path + File.separator + name); System.out.println("[INFO]: Reading from " + path + File.separator + name); TFileInputStream fin = new TFileInputStream(f); if(f.length() > Integer.MAX_VALUE) { throw new IllegalStateException("The file you are reading is too large to read into an array directly"); } ByteArrayOutputStream bin = new ByteArrayOutputStream(); byte[] buf = new byte[1024]; while(fin.read(buf) != -1) { bin.write(buf); } byte[] input = bin.toByteArray(); fin.close(); return input; } catch(IOException e) { throw new IllegalStateException("Could not read data from archive"); } } private String getString(String name) { byte[] input = getBytes(name); //SOMETHING HERE return the string }