- package com.fh.controller.ruitai.util;
- import java.io.BufferedInputStream;
- import java.io.File;
- import java.io.FileInputStream;
- public class TomcatUtil {
- /**
- * @Description 读取文件
- * @author 张洋.
- * @date
- * @return
- * @throws ExceptionFile
- */
- public staticString GetIdentified()throwsException {//File f =newFile(TomcatUtil.class.getClassLoader().getResource("tomcatdentified.txt").getPath().replaceAll(" ", " "));
- FileInputStream input =new FileInputStream(f);
- BufferedInputStream buf =new BufferedInputStream(input);
- byte[] b =new byte[(int) f.length()];
- input.read(b);
- input.close();
- String identified=new String(b);
- return identified;
- }
- public static void main(String[] args) {
- try {
- GetIdentified();
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- }
来源: http://www.bubuko.com/infodetail-1961281.html