• Post Reply Bookmark Topic Watch Topic
  • New Topic

ByteArrayInputstream to a file

 
venkataramana raju
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

i got data as a Object of ByateArrayInputstream
how can i write in to a file

thanks in advance
 
venkataramana raju
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi ,
i find out way

ByteArrayInputStream byteArrayInputStream = sysObj.getContent();
String outStr=byteArrayInputStream.toString();

File newFile=new File("somefilname");
FileOutputStream fos = new FileOutputStream(newFile);
int data;
while((data=byteArrayInputStream.read())!=-1)
{
char ch = (char)data;
fos.write(ch);
}
fos.flush();
fos.close();

thanks
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!