Uploading a file of any type and size:
----------------------------------------------
bos = new BufferedOutputStream(new FileOutputStream(new File(
file.getAbsolutePath() + File.separator
+ event.getFile().getFileName())));
bis = new BufferedInputStream(event.getFile().getInputstream());
byte[] b = new byte[bis.available()];
while (bis.read(b) != -1)
bos.write(b);
------------------------------------------------
----------------------------------------------
bos = new BufferedOutputStream(new FileOutputStream(new File(
file.getAbsolutePath() + File.separator
+ event.getFile().getFileName())));
bis = new BufferedInputStream(event.getFile().getInputstream());
byte[] b = new byte[bis.available()];
while (bis.read(b) != -1)
bos.write(b);
------------------------------------------------
File file = new File("test.txt"); FileReader fileReader = new FileReader(file); BufferedReader bufferedReader = new BufferedReader(fileReader); StringBuffer stringBuffer = new StringBuffer(); String line; while ((line = bufferedReader.readLine()) != null) { stringBuffer.append(line); stringBuffer.append("\n");
No comments:
Post a Comment