Sunday, November 7, 2010

Convert a ByteArrayInputStream to a XML file

InputStream input;
OutputStream out = new FileOutputStream("file location");
int read=0;
input = registry.get(Path).getContentStream();

byte[] bytes = new byte[1024];


while((read = input.read(bytes))!= -1){
out.write(bytes, 0, read);
out.write( '\n' );
}

input.close();
out.flush();
out.close();

System.out.println("New file created!");

No comments:

Post a Comment