Created
April 10, 2013 06:32
-
-
Save sulmansarwar/5352275 to your computer and use it in GitHub Desktop.
read from inputstream and store in file. Java.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* read from input stream and store in file. | |
*/ | |
InputStream in = ..... | |
File file = File.createTempFile(filename,".dat"); | |
FileOutputStream fos = new FileOutputStream(file,true); | |
byte[] b = new byte[4096]; | |
while(in.read(b, 0, 4096) != -1) | |
{ | |
fos.write(b,0,4096); | |
} | |
fos.flush(); | |
fos.close(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment