Nope. Or may, I'm not using it correctly.

Is there not any Util in java that can load a File from a byte[]? 

-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED]
On Behalf Of Albert Strasheim
Sent: 05 July 2006 12:02
To: [email protected]
Subject: [CTJUG Forum] Re: Loading a java.io.File from a Byte[]


Hey Roger

Roger Baatjes wrote:
> Here is my code to read bytes from a File. I now need to get a 
> java.io.File from a byte Array[]. The byte array represents the file I

> need to send.
> 
> How do I do that please?
> --------------------------------------------
> 
> InputStream is = new FileInputStream(file); byte[] bytes = new 
> byte[(int)length];
> 
> int offset = 0;
>         int numRead = 0;
>         while (offset < bytes.length
>                && (numRead=is.read(bytes, offset, 
> bytes.length-offset)) >=
> 0) {
>             offset += numRead;
>         }

Does ByteArrayInputStream and ByteArrayOutputStream solve your problem?

Regards,

Albert




--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CTJUG Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/CTJUG-Forum
For the ctjug home page see http://www.ctjug.org.za
-~----------~----~----~----~------~----~------~--~---

Reply via email to