List of utility methods to do OutputStream Write
void | writeStream(String content, String charset, OutputStream outputStream) write Stream if (content != null) {
outputStream.write(content.getBytes(charset));
outputStream.flush();
|
int | writeStreamBuffered(final Reader in, final Writer out) write Stream Buffered return writeStreamBuffered(in, out, DEFAULT_BUFFER_SIZE);
|
void | writeStreamCharwise(final Reader in, final Writer out) write Stream Charwise for (int read; (read = in.read()) != -1;) { out.write(read); |
int | writeStreamCharwiseLimited(final Reader in, final Writer out, final int len) write Stream Charwise Limited int read; int count = 0; while (true) { read = in.read(); if (read == -1) { return count; out.write(read); ... |
void | writeStreamFromString(String contents, OutputStream outputStream) write Stream From String if (contents == null) { return; char[] buffer = new char[0x10000]; Reader in = new InputStreamReader(new ByteArrayInputStream(contents.getBytes("UTF-8"))); Writer out = new OutputStreamWriter(outputStream, "UTF-8"); int read; do { ... |
ObjectOutputStream | writeStreamFromString(String serializePath) write Stream From String ObjectOutputStream oos; if (serializePath.endsWith(".gz")) { oos = new ObjectOutputStream( new BufferedOutputStream(new GZIPOutputStream(new FileOutputStream(serializePath)))); } else { oos = new ObjectOutputStream(new BufferedOutputStream(new FileOutputStream(serializePath))); return oos; ... |
void | writeStreamInFile(File f, InputStream in) write Stream In File FileOutputStream fout = null; byte[] buffer = new byte[4096]; int bytesRead; fout = new FileOutputStream(f); while ((bytesRead = in.read(buffer)) >= 0) { fout.write(buffer, 0, bytesRead); in.close(); ... |
void | writeStreamText(OutputStream out, String text) Writes the text data to the specified output stream. writeLinesCommon(out, text); |
byte[] | writeStreamToArray(InputStream stream) write Stream To Array ByteArrayOutputStream baos = new ByteArrayOutputStream(); byte[] buffer = new byte[1024]; int length = 0; while ((length = stream.read(buffer)) != -1) baos.write(buffer, 0, length); return baos.toByteArray(); |
void | writeStreamToStream(InputStream in, OutputStream out) write Stream To Stream byte[] buff = new byte[1024]; for (int read = in.read(buff); read > 0; read = in.read(buff)) { out.write(buff, 0, read); |