读取文件,生成随机文件名

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/XUEER88888888888888/article/details/86559906
// 读取数据
	public String ReaderjsonAll(String url) {
		StringBuffer text = new StringBuffer();
		BufferedReader br = null;
		try {
			br = new BufferedReader(new InputStreamReader(new FileInputStream(url), "gbk"));
			String line = br.readLine();
			while (null != line) {
				text.append(line);
				line = br.readLine();
			}
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		
		LOG.info("测试读取数据"+text.toString());
		return text.toString();
	}



//生成指定文件名的文件
 public static String filePath(String path)throws Exception{

        String savePath = path;
        String uuid = UUID.randomUUID().toString().replace("-", "");//随机字串
        String suffix = ".html";
        String randomName = uuid+suffix;
        String fullName = savePath + File.separator + randomName;

        File file2=new File(fullName);
        file2.createNewFile();



        return file2.toString();

    }

猜你喜欢

转载自blog.csdn.net/XUEER88888888888888/article/details/86559906
今日推荐