package utility;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.Scanner;

public class IdcTxtGetter
{
	//txt파일 읽어옴
	public String getText(String path)
	{
		String result = "";
		FileInputStream fis=null;
		Scanner s=null;
		File file= new File(path);
		try 
		{
			fis = new FileInputStream(file);
			s = new Scanner(fis);
			while(s.hasNext())
			{
				result = result.concat(s.nextLine()+"\r\n");
			}
		}
		catch(FileNotFoundException e)
		{
			System.out.println("파일 못찾음 ㅠ");
			e.printStackTrace();
		}
		catch (Exception e) 
		{
			System.out.println("txtGetter exception");
			e.printStackTrace();
		}
		finally
		{
			try 
			{
				if(fis!=null)
					fis.close();
				if(s!=null)
					s.close();
			}
			catch (Exception e) 
			{
				e.printStackTrace();
			}
		}
		return result;
	}
}
