|
next
|
Subject: SS 2007 vs. SS 2008 calling a custom txt2xml adapter Author: Hans Sprungfeld Date: 20 Dec 2007 09:54 AM
|
Hi there,
I'm playing around with the new 2008 Version and all the good stuff from 2007 in Java is now deprecated.
All the good stuff, described here is now deprecated :-(
Copied from another topic:
-------------------------------------
You need to use a different createStylusFile method to do that:
public StylusFile createStylusFile(String url,
InputStream is)
throws IOException
Create a StylusFile object for file access through a custom file system. This method differs from createStylusFile(String) in that it invokes a 2 argument constructor (String, InputStream) of the StylusFile class. This is useful if the StylusFile object being created is an adapter or converter which will read input from the InputStream. The application will normally get the result of the conversion by calling getInputStream() and using it to read the converted data.
If you apply that to one of the examples in demo.java, you can do a stream-to-stream operation:
File in_1 = new File(datapath + File.separator + "one.csv");
InputStream is = new FileInputStream(in_1);
StylusFile converter = sff.createStylusFile("adapter:///CSV:sep=,:first=yes", is); //note that we dropped the file from the URL
File out_1 = new File(datapath + File.separator + "one.xml");
OutputStream os = new FileOutputStream(out_1);
copy(converter.getInputStream(), os);
os.close();
is.close();
converter.close();
The "is" input stream is built against a file in this case, but it could be anything which is an InputStream really.
BTW, there is also a "createStylusFile(String url, OutputStream os)" for creating stream-to-stream of XML-to-nonXML conversions.
------------------------------
How can I do this with the 2008 version? Is there a javadoc available?
Hope you can help me.
Thanks in advance and best regards.
Loki2
|
|
|