on 05-16-2007 4:46 PM
Hello,
does anyone have an ide how to create java mapping to create empty file on FTP?
Why this code always send NUL character = 1byte and not 0 byte as needed?
public void execute(InputStream in, OutputStream out) throws StreamTransformationException {
...
out = null;
...
}
Hi
We can handle it in adapter itself , if the message is empty then we can handle it.
Regards
Chilla
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
But what does it mean that message is empty.? I think it means that the payload's size is 0. I thought that I could get it via java mapping and setting OutputStream = null. Then you could handle it in adapter, and set write empty file.
But even I set outputstream to null I get nul char in that stream and it has byte, so it's not empty any more!!! And I also have the requirement that the file have to be 0 byte.
HI,
You might want to fill the OutputStream with an empty string "" rather than with a null. Not sure if this could be a solution, but you can definetly try this out.
Vijay
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
try 1 thing...
run ur code for some standalone file.
create a file at ur local harddisk and check out its size..
i had tried creating such a file using the code below....
it is creating a 0 byte file successfully.
public class TestCode {
public static void main(String ags[]){
try{
TransformerFactory tf = TransformerFactory.newInstance();
Transformer transform = tf.newTransformer();
FileOutputStream out;
out = new FileOutputStream("c:
OutTestCode.xml");
transform.transform(null, new StreamResult(out));
} catch (FileNotFoundException e1) {
e1.printStackTrace();
} catch (TransformerConfigurationException e) {
e.printStackTrace();
} catch (TransformerException e) {
e.printStackTrace();
}
}
}
Hi,
yes all I need is to create empty file in file adpater. So I thought that when I set outputstrem to null, or to "".getBytes(), outputstreem will be empty, therefore file adapter will create empty 0byte file(SP19 file adpater feature, write empty files/ignore).
And as I said I always get NUL character, 1byte file. Bad bad bad...
Thanks.
User | Count |
---|---|
89 | |
10 | |
9 | |
9 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.