List of utility methods to do OutputStream Write
void | serializeUUID(OutputStream out, UUID id) serialize UUID long msb = id.getMostSignificantBits(); long lsb = id.getLeastSignificantBits(); byte[] data = new byte[16]; data[0] = (byte) ((msb >>> 56)); data[1] = (byte) ((msb >>> 48)); data[2] = (byte) ((msb >>> 40)); data[3] = (byte) ((msb >>> 32)); data[4] = (byte) ((msb >>> 24)); ... |
void | writeStream(byte[] data, OutputStream os) write Stream os.write(data); os.flush(); |
void | writeStream(byte[] data, OutputStream out) Writes data into the stream and closes the output stream try { out.write(data); out.flush(); } finally { out.close(); |
void | writeStream(final OutputStream out, final String content, final boolean close) Write a string final PrintWriter writer = new PrintWriter(out); writer.println(content); if (close) { writer.close(); |
void | writeStream(InputStream _from, Writer _printTo) write Stream final Reader in = new BufferedReader(new InputStreamReader(new BufferedInputStream(_from))); while (in.ready()) _printTo.write(in.read()); |
void | writeStream(InputStream in, File file) Writes all data that can be read from the supplied InputStream to the specified file. FileOutputStream out = new FileOutputStream(file); try { transfer(in, out); } finally { try { out.flush(); } finally { out.close(); ... |
void | writeStream(InputStream inputStream, OutputStream out) write Stream try { int read = 0; byte[] bytes = new byte[inputStream.available()]; while ((read = inputStream.read(bytes)) > 0) { out.write(bytes, 0, read); inputStream.close(); out.flush(); ... |
void | writeStream(OutputStream out, byte[] data) write Stream |
void | writeStream(OutputStream output, String dataStr) Writes a String to the specified OutputStream byte data[] = dataStr.getBytes();
output.write(data, 0, data.length);
|
int | writeStream(OutputStream outputStream, InputStream inputStream, byte[] buffer) write Stream int totalWritten = 0; int read = 0; while ((read = inputStream.read(buffer)) > 0) { outputStream.write(buffer, 0, read); totalWritten += read; return totalWritten; |