//从string数组创建临时文件
private static File createSampleFile(String[] strs) throws IOException { File file = File.createTempFile("aws-java-sdk-", ".txt"); file.deleteOnExit(); Writer writer = new OutputStreamWriter(new FileOutputStream(file)); for (String str : strs) { writer.write(str); } writer.close(); return file; }