---
title: "读取文件数据"
author: "1018"
date: "2011-04-30T11:23:02Z"
tags: []
categories: ["编程语言"]
slug: "untitled"
draft: false
lastmod: "2011-04-30T11:23:02Z"
id: 1025379
url: "https://1018.iteye.com/blog/1025379"
---

```
	public static String readFileData(String filePath,String key){
		String fileData = "";
		Properties p = new Properties();
		FileInputStream fs = null;
		try {
			fs = new FileInputStream(filePath);
			try {
				p.load(fs);				
				fileData = p.getProperty(key);
			} catch (IOException e) {
				e.printStackTrace();
			}
		} catch (FileNotFoundException e) {
			e.printStackTrace();		}
     return fileData;
	}
	
```