All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.paganini2008.devtools.io.StringArrayWriter Maven / Gradle / Ivy

There is a newer version: 2.0.5
Show newest version
package com.github.paganini2008.devtools.io;

import java.io.IOException;
import java.io.Writer;
import java.util.ArrayList;
import java.util.List;

/**
 * 
 * StringArrayWriter
 * 
 * @author Fred Feng
 * @revised 2019-05
 * @created 2019-05
 * @version 1.0
 */
public class StringArrayWriter extends Writer {

	private final List lines = new ArrayList();

	public void write(String str) {
		lines.add(str);
	}

	public void write(char[] cbuf, int off, int len) throws IOException {
		lines.add(new String(cbuf, off, len));
	}

	public void flush() throws IOException {
	}

	public void close() throws IOException {
		lines.clear();
	}

	public String[] toArray() {
		return lines.toArray(new String[0]);
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy