Re: Reading files
2008/7/11 David Nedrow [EMAIL PROTECTED]: Here's what I've have... IResourceStream resStream = new PackageResourceStream(WicketApplication.class, protocols.csv); InputStream inStream = resStream.getInputStream(); InputStreamReader isr = new InputStreamReader(inStream); ListString[] protocolList = new CSVReader(isr).readAll(); inStream.close(); You don't need to involve Wicket in this. Reader reader = new InputStreamReader(WicketApplication.class.getResourceAsStream(protocols.csv)); ListString[] protocolList = new CSVReader(reader).readAll(); reader.close(); Regards, Al
Re: Reading files
On Jul 9, 2008, at 6:52 AM, greeklinux wrote: Hello, I do not know if it helps: Can you read the CSV file as Resource, get the IResourceStream, then getInputStream() on IResourceStream and put this inputStream in a java.io.InputStreamReader? Yeah, that's basically where I am. I thought maybe there was a way to simplify the process. Here's what I've have... IResourceStream resStream = new PackageResourceStream(WicketApplication.class, protocols.csv); InputStream inStream = resStream.getInputStream(); InputStreamReader isr = new InputStreamReader(inStream); ListString[] protocolList = new CSVReader(isr).readAll(); inStream.close(); I could collapse this a bit, but I need to keep hold of IResourceStream so that I can close it after the CSVReader.readAll() call. -David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Reading files
Hello, I do not know if it helps: Can you read the CSV file as Resource, get the IResourceStream, then getInputStream() on IResourceStream and put this inputStream in a java.io.InputStreamReader? greetings David Nedrow-3 wrote: I have a third party package that requires a java.io.Reader (or descendent) as an input. I need to provide a Reader for a file locate in either WEB-INF (or possibly package sourced). This file is a CSV list of items that is used to initialize a database table. I just need to iterate over it and send it off to my DAO. I've looked at a couple of options, but it seems like I'm traversing an inordinately large number of classes just to get hold of some type of Reader. Any suggestions on a wicket friendly, yet straightforward way to handle this type of activity? -David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/Reading-files-tp18321041p18358873.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]