라이브러리 애플릿 로드

//     UTF-8                  
//                    
 
 
 
 
import java.io.BufferedWriter;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;


public class AddNewWord {
	public static OutputStreamWriter osw=null;
	public static BufferedWriter bw=null;
	public static String newWord;
	public static String path;
	public static ArrayList<String> list;
	 
			public void addNewWords(String newWord,String path) 
			{
				
				
				try {
					osw=new OutputStreamWriter(new FileOutputStream(path,true),"UTF-8");
					bw=new BufferedWriter(osw);
					//bw.newLine();
					bw.append(newWord);
					bw.newLine();
					//System.out.println("    !");
					
				} catch (IOException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
					System.out.println("    ");
				}
				finally
				{
					if (bw!=null)
					{
						try {
							bw.close();
						} catch (IOException e) {
							// TODO Auto-generated catch block
							e.printStackTrace();
							System.out.println("     ");
						}
					}
				}
				
			}
		  public void addArraryWords(Collection<String> list,String path)
		  {
			  Iterator <String>it=list.iterator();
			 
			  while (it.hasNext())
				  {
					 
					try {
						osw=new OutputStreamWriter(new FileOutputStream(path,true),"UTF-8");
						bw=new BufferedWriter(osw);
						//bw.newLine();
						
						bw.append(it.next().toString());
						bw.newLine() ;
					} catch (IOException e) {
						// TODO Auto-generated catch block
						e.printStackTrace();
						System.out.println("        ");
					}
					finally
					{
						if (bw!=null)
							try {
								bw.close();
							} catch (IOException e) {
								// TODO Auto-generated catch block
								e.printStackTrace();
								System.out.println("     ");
							}
					}
					 
				  
			  }
		
		  }
	      
}		   

좋은 웹페이지 즐겨찾기