package com.sabirjan.CaoZuoTXT;

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

import android.content.Context;

public class ChaXunDianHua {

	public String GetNumberInfo(Context context,String mobileNumber)
	{
		
		
		String fileName="mobile/"+mobileNumber.substring(0,3)+".txt";
			if(mobileNumber.length()>7)
		{
			mobileNumber=mobileNumber.substring(0,7);
		}
		// 存储内容的文本对象
		StringBuilder text = new StringBuilder();

		try {
			BufferedReader bufRead = new BufferedReader(new InputStreamReader(context.getResources().getAssets().open(fileName),"utf-8"));  
			
		    String line;

		    while ((line = bufRead.readLine()) != null) 
		    {
		       if(line.startsWith(mobileNumber))
		       {
		    	   return line;
		       }
		    }
		}
		catch (IOException e) {
		    // 增加异常处理
			return e.getMessage();
		}
		return "";
	}
	
}
