cn.com.cjf.config.LoadConfig Maven / Gradle / Ivy
package cn.com.cjf.config;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import cn.com.cjf.entity.Char;
/**
* ???????ļ???-???? ??????-???? ???յ???Դ?ļ??ļ??ع???
* @author saiya [email protected]
* @lastEdit 2008-10-28
*/
public class LoadConfig {
/**
* Ҫ???ص? ????-????ӳ???ļ????ļ??ĸ?ʽ??UTF-8
*/
public static final String fjMapUTF8="fj_map_utf8.properties";
/**
* Ҫ???ص? ????-????ӳ???ļ????ļ???ʽ??UTF-8
*/
public static final String jfMapUTF8="jf_map_utf8.properties";
/**
* LoadConfig ????
*/
private static LoadConfig instance = null ;
/**
* ??ñ?????
* @return
*/
public static LoadConfig getInstance(){
if(instance==null){
instance=new LoadConfig();
}
return instance;
}
/**
* ???ط???-????ӳ?䣬?? Char[] ????ʽ???
* @return
* @throws IOException ??????Դ?ļ?IO???????⣬?????ļ??е???Դ???????ݳ????쳣ʱ?׳?
*/
public Char[] loadFJmapUTF8() throws IOException{
String line=null;
ArrayList list = new ArrayList();
BufferedReader br = null;
Char[] charList = null;
try{
br = this.getReader(fjMapUTF8);
int index=0;
while((line=br.readLine())!=null){
if(line.startsWith("#")){
continue;
}
if(line.trim().length()==0){
continue;
}
char fChar=line.charAt(0);
char jChar=line.charAt(2);
if(index>=(int)fChar){
list=null;
throw new IOException("?Բ????????????ļ?["+fjMapUTF8+"]?????⣡FCharId="+(int)fChar);
}
index=(int)fChar;
list.add(new Char(jChar,fChar));
}
charList=new Char[list.size()];
for(int i=0;i=(int)jChar){
list=null;
throw new IOException("?Բ????????????ļ?["+jfMapUTF8+"]?????⣡JCharId="+(int)jChar);
}
index=(int)jChar;
list.add(new Char(jChar,fChar));
}
charList=new Char[list.size()];
for(int i=0;i
© 2015 - 2025 Weber Informatics LLC | Privacy Policy