apache FTPClient

B

Bricker, M.

when I retrieve a file using FTPClient, the data is corrupted (I know
this because the file is no longer readable by the application using
the data). I tried specifying file time either ascii or binary. same
problem either way. I was wondering if the outputstream messes with
the data, since it is in bytes. The application (being c++) writes
and read in (char*). Thanks.
 
L

Lew

Bricker said:
when I retrieve a file using FTPClient, the data is corrupted (I know
this because the file is no longer readable by the application using
the data). I tried specifying file time either ascii or binary. same
problem either way. I was wondering if the outputstream messes with
the data, since it is in bytes. The application (being c++) writes
and read in (char*). Thanks.

If you implemented the "outputstream [sic]" with java.io_OutputStream then it
didn't "mess with" the data. I don't know anything about 'FTPClient', though
- where does it come from?

If 'FTPClient' is a Java class or project, then it isn't retrieving the file
using an output stream but using an input stream, probably a subclass or
variant of java.io.InputStream.

Whatever is writing to the output stream might be doing something to the data.
You haven't indicated what it is, so it's hard to know. What is writing
the data to the output stream?

Your comment that "[t]he application (being c++ [sic]) writes and read [sic]
in (char*)" is a bit ambiguous. I assume you mean that it uses a 'char'
pointer to locate a (C++) 'char' array and is using it as a byte array.

I don't see how anyone here can help you with such a dearth of information.
 
A

Arne Vajhøj

Bricker said:
when I retrieve a file using FTPClient, the data is corrupted (I know
this because the file is no longer readable by the application using
the data). I tried specifying file time either ascii or binary. same
problem either way. I was wondering if the outputstream messes with
the data, since it is in bytes. The application (being c++) writes
and read in (char*).

I have seen things happen with binary files when using
ftpclient.retrieveFileStream/ftpclient.storeFileStream
and copying data manually.

Try using Util.copyStream to copy data.

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top