[Html] save String as a file.
Save the String as a file. [Html]/**
* Save String data as a file
*/
Public static File getFileFromBytes (String name, String path ){
Byte [] B = name. getBytes ();
BufferedOutputStream stream = null;
File file = null;
Try {
File = new File (path );
FileOutputStream fstream = new FileOutputStream (file );
Stream = new BufferedOutputStream (fstream );
Stream. write (B );
} Catch (Exception e ){
E. printStackTrace ();
} Finally {
If (stream! = Null ){
Try {
Stream. close ();
} Catch (IOException e1 ){
E1.printStackTrace ();
}
}
}
Return file;
}
/**
* Save String data as a file
*/
Public static File getFileFromBytes (String name, String path ){
Byte [] B = name. getBytes ();
BufferedOutputStream stream = null;
File file = null;
Try {
File = new File (path );
FileOutputStream fstream = new FileOutputStream (file );
Stream = new BufferedOutputStream (fstream );
Stream. write (B );
} Catch (Exception e ){
E. printStackTrace ();
} Finally {
If (stream! = Null ){
Try {
Stream. close ();
} Catch (IOException e1 ){
E1.printStackTrace ();
}
}
}
Return file;
}
Save byte data as a file:
[Html]/**
* Save byte data as a file www.2cto.com
*/
Public static File getFileFromBytes (byte [] B, String path ){
BufferedOutputStream stream = null;
File file = null;
Try {
File = new File (path );
FileOutputStream fstream = new FileOutputStream (file );
Stream = new BufferedOutputStream (fstream );
Stream. write (B );
} Catch (Exception e ){
E. printStackTrace ();
} Finally {
If (stream! = Null ){
Try {
Stream. close ();
} Catch (IOException e1 ){
E1.printStackTrace ();
}
}
}
Return file;
}
From agods-footprint