now i want to write this new string to the same file, tryied storeFileStream but didnt get too far cause it is an Outputstream and not a FileOutputStream, and lookin around it seems there is no way to convert from one to another, maybe im approaching the problem from the wrong side...any tip???
hi , thanks for the reply
but i have no idea of how to do what you said i can instantiate OutputStreamWriter and BufferedWriter to write a file on local machine, but dont know how to pass the string to the remote file using
client.someMethodIdontKnow()))
can you please post an example of what you mean with "wrappin them around" the OutputStream?
but i get a null pointer exception on the second line...retrieved is surely not a null string, maybe the exception comes because of the storeFileStream method but i dont see any alternative in ftpclient documentation for writing on server file, and i dont want to create the file locally and then store it cause it will compel me to sign the application and i want it to operate totally serverside instead...any help?
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35241
7
posted
0
Start by finding out which object in which command is null.
the null exception is about the OutputStreamWriter, at
OutputStreamWriter os=new OutputStreamWriter(out,"UFT-8");
but out is ok, the encoding is ok...
after the exception i found the txt file on the server has been cleared, but the string i write on it is not a null one
the file TempContact is created but it is empty, and i still get the nullpointerexception.
i read storefilestream can return null if there are file access conflicts but the previous inputstream is closed and im logged out from site control panel,
how comes???
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35241
7
posted
0
This: "write test".getBytes() is not a good idea; you should always specify the encoding, especially when there are different computers involved. Relying on the platform default encoding is bound to cause problems.
What does client.getReplyString() return?
im logged out from site control panel
What control panel? What does that have to do with running this code?
i've added a "UTF-8" i mean the control panel where you manually manage your site, i thought it would cause an access conflict so i logged out before try, but nevermind,
the problem was i forgot to add a completependingcommand after closing the inputstream so it somehow denied the outputstream access to the file, now everything works fine
just a last tip, writing the string byte i lose all the "\n" so instead of returning words are alltoghether, is there a way to return in byte?
thanks for the help
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35241
7
posted
0
Try setting the transfer mode to BINARY instead of ASCII; that should leave the file alone.
a waste of time so far...
i did the whole job to avoid making a signed applet, but when on browser the applet asks again for permissions...
dont know why since im not doing anything on local machine, the only file im editing is the one on server...
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35241
7
posted
0
The exception should tell you which method or class causes it.