List of utility methods to do File Append
void | appendFile(String source, String filetoappend) append File try { boolean append = true; File filesrc = new File(source); BufferedWriter output = new BufferedWriter(new FileWriter(filesrc, append)); File ftoappend = new File(filetoappend); BufferedReader br = new BufferedReader(new FileReader(ftoappend)); String line = br.readLine(); while (line != null) { ... |
boolean | appendFile(String strThrift, String filePath) append File PrintWriter out = null; try { out = new PrintWriter(new BufferedWriter(new FileWriter(filePath, true))); out.println(strThrift); out.flush(); out.close(); } catch (IOException e) { return false; ... |
boolean | appendFileBytes(String srcFileName, String tarFileName) append File Bytes BufferedInputStream inBuff = null; BufferedOutputStream outBuff = null; try { inBuff = new BufferedInputStream(new FileInputStream(srcFileName)); outBuff = new BufferedOutputStream(new FileOutputStream(tarFileName, true)); byte[] b = new byte[1024 * 5]; int len; while ((len = inBuff.read(b)) != -1) { ... |
void | appendFileContent(File file, String content, boolean append) Appends content to given file. Writer fw = null; try { fw = new OutputStreamWriter(new FileOutputStream(file, append), "UTF-8"); fw.append(content); } finally { if (fw != null) fw.close(); |
boolean | appendFileLines(String fileName, String[] data) { method return appendFileLines(new File(fileName), data); |
void | appendFilePart(File dstFile, byte[] bytes) Helper method to append bytes to a specified file. try (FileOutputStream outputStream = new FileOutputStream(dstFile, true);) { outputStream.write(bytes); outputStream.flush(); } catch (IOException e) { throw new RuntimeException( "Could not create and append the bytes to the file " + dstFile.getAbsolutePath()); |
A | appendHex(A sb, byte[] array, int offset, int len, char sep) append Hex if (len <= 0) { return sb; for (int curOffset = offset, maxOffset = offset + len; curOffset < maxOffset; curOffset++) { byte b = array[curOffset]; if ((curOffset > offset) && (sep != EMPTY_HEX_SEPARATOR)) { sb.append(sep); sb.append(HEX_DIGITS.charAt((b >> 4) & 0x0F)); sb.append(HEX_DIGITS.charAt(b & 0x0F)); return sb; |
void | appendHexJavaScriptRepresentation(Appendable out, int codePoint) Returns a javascript representation of the character in a hex escaped format. if (Character.isSupplementaryCodePoint(codePoint)) { char[] surrogates = Character.toChars(codePoint); appendHexJavaScriptRepresentation(out, surrogates[0]); appendHexJavaScriptRepresentation(out, surrogates[1]); return; out.append("\\u").append(HEX_CHARS[(codePoint >>> 12) & 0xf]).append(HEX_CHARS[(codePoint >>> 8) & 0xf]) .append(HEX_CHARS[(codePoint >>> 4) & 0xf]).append(HEX_CHARS[codePoint & 0xf]); ... |
void | appendHexJavaScriptRepresentation(StringBuilder sb, char c) append Hex Java Script Representation try { appendHexJavaScriptRepresentation(c, sb); } catch (IOException ex) { throw new RuntimeException(ex); |
void | appendTo(String fileName, String str) Append a String to a file. RandomAccessFile f = null; if (str == null) return; try { f = new RandomAccessFile(fileName, "rw"); long length = f.length(); f.seek(length); f.write(str.getBytes()); ... |