Java Utililty Methods File Append

List of utility methods to do File Append

Description

The list of methods to do File Append are organized into topic(s).

Method

StringBufferappendTo(StringBuffer sb, CharSequence s)
append To
return appendTo(sb, s, 0, s.length());
File[]appendToArray(final File[] original, final File[] toAppend)
append To Array
Vector<File> toReturn = new Vector<File>();
for (int i = 0; i < original.length; i++) {
    File file = original[i];
    toReturn.add(file);
for (int i = 0; i < toAppend.length; i++) {
    File file = toAppend[i];
    toReturn.add(file);
...
VectorappendToCollection(final Vector original, final File[] toAppend)
append To Collection
Vector<File> toReturn = new Vector(original);
for (int i = 0; i < toAppend.length; i++) {
    File file = toAppend[i];
    toReturn.add(file);
return toReturn;
FileappendToFileName(File file, String str)
append To File Name
String properPath = file.getPath().substring(0, file.getPath().lastIndexOf(File.separator));
String fileNameWithoutExt = file.getName().substring(0,
        file.getName().lastIndexOf(".") == -1 ? file.getName().length() : file.getName().lastIndexOf("."))
        + str.replaceAll("\\s", "_");
return new File((properPath + File.separator + fileNameWithoutExt + ".srt"));
voidappendToken(StringBuilder path, String token, boolean skipEmpty, boolean skipSeparator)
append Token
if (skipEmpty && (token == null || token.length() == 0)) {
    if (skipSeparator) {
        path.replace(path.length() - 1, path.length(), "");
    return;
path.append(token);
if (!skipSeparator)
...
voidappendToOutput(InputStream input, OutputStream output)
append To Output
byte[] buffer = new byte[8192];
int bytesRead;
try {
    while ((bytesRead = input.read(buffer)) != -1) {
        output.write(buffer, 0, bytesRead);
} catch (IOException e) {
    throw new RuntimeException(e);
...
voidappendToOutputStream(OutputStream out, String value)
append To Output Stream
out.write(value.getBytes("UTF-8"));