Re: Sending Files over Network (ObjectStream)
From: Gabriel Gudenus (gabriel_at_gudenus.com)
Date: 12/09/03
- Next message: Sulle Tracce: "cult3d e java"
- Previous message: megha: "session end problem in jsp"
- In reply to: Anthony Borla: "Re: Sending Files over Network (ObjectStream)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 9 Dec 2003 00:31:54 -0800
"Anthony Borla" <ajborla@bigpond.com> wrote in message news:<Fp7Bb.44955$aT.5219@news-server.bigpond.net.au>...
> "Gabriel Gudenus" <gabriel@gudenus.com> wrote in message
> news:f2521f6.0312080525.4e96ef27@posting.google.com...
>
> The important question, here, is: What do you want to send ?
>
> * A 'File' object ? Or,
>
> * The contents [bytes comprising] of the file, 'hi.exe' ?
>
I wanted to exchange the contents (so whole file except path and
filename info)
> On the other hand, if the latter, the easiest approach would probably be to
> create a Serializable class containing a 'byte[]', read the contents of
> 'hi.exe' into it, and send this object off. The receiver will then
> reconstitute this object, and perhaps recreate 'hi.exe'.
Was a great Idea! I just used it for Demo Purposes with the Byte class
and worked really good (except OutOfMemory Problem at files bigger 2
Meg)
Here the solution:
//Client I know that i receive a file now because of message before
//fos = FileOutputStream
o = objIn.readObject();
while (o instanceof Byte) { fos.write(((Byte) o).byteValue());
o = objIn.readObject();
}
Thanks for your Help!
Gabriel
- Next message: Sulle Tracce: "cult3d e java"
- Previous message: megha: "session end problem in jsp"
- In reply to: Anthony Borla: "Re: Sending Files over Network (ObjectStream)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]