Java BufferedReader Read loadClob(File f, String enc)

Here you can find the source of loadClob(File f, String enc)

Description

load Clob

License

Apache License

Declaration

public static char[] loadClob(File f, String enc) throws Exception 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;

import java.io.InputStreamReader;

public class Main {
    public static char[] loadClob(File f, String enc) throws Exception {
        char[] data = null;
        BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(f), enc));
        char[] tmp = new char[4096];
        int num = 0;
        try {/*from  www  .  ja  v a 2  s. c  o  m*/
            while ((num = br.read(tmp)) > 0) {
                if (data == null) {
                    data = new char[num];
                    System.arraycopy(tmp, 0, data, 0, num);
                } else {
                    char[] old = data;
                    data = new char[old.length + num];
                    System.arraycopy(old, 0, data, 0, old.length);
                    System.arraycopy(tmp, 0, data, old.length, num);
                }
            }
        } finally {
            br.close();
        }
        return data;
    }
}

Related

  1. loadAuthFile(String fileName)
  2. loadBase64Object(BufferedReader rdr, String type)
  3. loadBlackList(String blackListPath)
  4. loadBussinessGroupCompanies(String file_path)
  5. loadByUsingSplit(String filename)
  6. loadCommonMisspellingsFile(String commonMisspellingsFileLocation)
  7. loadConfFile(String filename, String key)
  8. loadConfig(File conf)
  9. loadConfigProps(String configFile)