lunes, 18 de junio de 2007

Convertir byte[] a archivo

File file = new File(name);
file.createNewFile();
FileInputStream fileInputStream = new FileInputStream(name);
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(fileData);
OutputStream outputStream = new FileOutputStream(
name);
int data;
while ((data = byteArrayInputStream.read()) != -1) {
outputStream.write(data);
}

fileInputStream.close();
outputStream.close();

No hay comentarios: