List of utility methods to do Text File Save
void | writeFile(final String outputDir, final String response, final String fileName) write File File dir = new File(outputDir); dir.mkdirs(); File file = new File(dir, fileName); final FileWriter writer = new FileWriter(file); try { writer.write(response); } finally { writer.close(); ... |
void | writeFile(IFile annotationFile, StringBuffer head, String annotatedSignature, String nextLines, BufferedReader tailReader, IProgressMonitor monitor) Write back the given annotationFile, with the following content: - head (assumed to include a member and its original signature - annotatedSignature - nextLines (optionally, may be null) - the still unconsumed content of tailReader head.append(' ').append(annotatedSignature).append('\n'); if (nextLines != null) head.append(nextLines).append('\n'); String line; while ((line = tailReader.readLine()) != null) head.append(line).append('\n'); ByteArrayInputStream newContent = new ByteArrayInputStream(head.toString().getBytes("UTF-8")); annotationFile.setContents(newContent, IResource.KEEP_HISTORY, monitor); ... |
void | writeFile(IFile file, final InputStream contents, final String charset, IProgressMonitor monitor) write File if (!file.exists()) { file.create(contents, true, monitor); } else { file.setContents(contents, true, true, monitor); file.setCharset(charset, monitor); |
void | writeFile(List write File writeFile(data, f.getAbsolutePath()); |
void | writeFile(List Writes a List of Strings, each String representing a line in the file, to the file at the specified pathname. try { BufferedWriter writer = new BufferedWriter(new FileWriter(pathname)); Iterator<String> lineIter = fileLines.iterator(); if (lineIter.hasNext()) { writer.write(lineIter.next()); while (lineIter.hasNext()) { writer.newLine(); ... |
void | writeFile(List Write a list of lines to a file. writeFile(lines, new File(filePath));
|
void | writeFile(List write File try { File writeFile = new File(fileFullPath); new File(writeFile.getParent()).mkdirs(); writeFile.createNewFile(); BufferedWriter out = new BufferedWriter(new FileWriter(writeFile)); for (String str : strList) { out.write(str + LINE_SEPARATOR); out.flush(); out.close(); } catch (IOException e) { e.printStackTrace(); |
boolean | writeFile(List write File boolean tag = true; try { FileWriter writer = new FileWriter(MyFilePath); BufferedWriter bufWriter = new BufferedWriter(writer); for (String txtData : txtList) { bufWriter.write(txtData); bufWriter.newLine(); bufWriter.close(); writer.close(); } catch (Exception e) { tag = false; e.printStackTrace(); return tag; |
String | writeFile(String file, String content) write File File log = new File(file); FileOutputStream fos; BufferedOutputStream bos; try { fos = new FileOutputStream(log); bos = new BufferedOutputStream(fos); bos.write(content.getBytes("UTF-8")); bos.close(); ... |
int | writeFile(String file, String text) write File return writeFile(file, text, null);
|