Java File Append appendFile(File f, StringBuffer sb)

Here you can find the source of appendFile(File f, StringBuffer sb)

Description

append File

Declaration

public static void appendFile(File f, StringBuffer sb) throws IOException 

Method Source Code


//package com.java2s;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;

public class Main {
    public static void appendFile(File f, StringBuffer sb) throws IOException {
        try {/* ww  w.j a  va 2 s  . c o m*/
            BufferedReader br = new BufferedReader(new FileReader(f));
            char[] buffer = new char[1000];
            int c = 0;

            while ((c = br.read(buffer)) > 0) {
                sb.append(buffer, 0, c);
            }
        } catch (IOException e) {
            throw (e);
        }

    }
}

Related

  1. appendContentsToFile(File file, StringBuilder contents)
  2. appendContentsTofile(String fileName, String contents)
  3. appendContentToFile(File file, String fileContent)
  4. appendFile(byte[] data, String file)
  5. appendFile(File f, String content)
  6. appendFile(File file, String content)
  7. appendFile(File file, String url)
  8. appendFile(File filename, String data)
  9. appendFile(File src, File dst)