You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Nathan Maves <Na...@Sun.COM> on 2005/08/16 17:38:37 UTC

Re: I want ask you a problem about ibatis.

John,


This is really a simple Java issue.

When you say that it is not a file you are correct.  It is just a  
java.lang.btye[].  But on the other hand a java.io.File is not a file  
either.  It is just a pointer to the actual files in your  
filesystem.  If you want to write the byte[] out to a new file on  
your filesystem just use simple file io.

Something like ......


OutputStream out = new FileOutpuStream(new File(<file_name_goes_here>));

byte[] bytes = new byte[1024];
int bytesRead;

while ((bytesRead = in.read(bytes)) != -1) {
     out.write(bytes, 0, bytesRead);
}

out.close();


Nathan

On Aug 16, 2005, at 4:10 AM, John Li wrote:

> dear :
> I have read your aticle named How do I use a BLOB or CLOB?
> Thank you for your article,but I have a doubt about it.
> You tell me how to insert and update the record use a blob or  
> clob.But I don't  know how to get a record ?
> I only get a object with byte[],but it isn't a file.
> How can I convert it to file?
> please help me .Thank you.
> regards,
> John
>