Open GoogleCodeExporter opened 9 years ago
Currently the load method requires a file name. This could be minimally refactored to take an input stream as an option instead: e.g. public static ParserData Load(InputStream inStream) { ParserData pData = null; try { GZIPInputStream gzis = new GZIPInputStream(inStream); // Compressed ObjectInputStream in = new ObjectInputStream(gzis); // Load objects pData = (ParserData)in.readObject(); // Read the mix of grammars in.close(); // And close the stream. } catch (IOException e) { System.out.println("IOException\n"+e); return null; } catch (ClassNotFoundException e) { System.out.println("Class not found!"); return null; } return pData; } public static ParserData Load(String fileName) { FileInputStream fis = null; try { fis = new FileInputStream(fileName); // Load from file return Load(fis); } catch (IOException e) { System.out.println("IOException\n"+e); return null; } finally { try { if (fis != null) fis.close(); } catch (IOException e) { e.printStackTrace(); } } }
Original issue reported on code.google.com by DavidBut...@gmail.com on 24 Jul 2009 at 4:36
DavidBut...@gmail.com
Original issue reported on code.google.com by
DavidBut...@gmail.com
on 24 Jul 2009 at 4:36