List of utility methods to do OutputStream Write Byte Array
void | writeBytes(byte[] data, OutputStream out) write Bytes transfer(new ByteArrayInputStream(data), out);
|
void | writeBytes(byte[] data, OutputStream out) Writes a given bytes to a stream. ByteArrayInputStream in = new ByteArrayInputStream(data); byte[] buffer = new byte[1024]; for (int n; (n = in.read(buffer)) > 0;) { out.write(buffer, 0, n); |
void | writeBytes(byte[] data, OutputStream stream) Writing byte array to stream stream.write(data); |
void | writeBytes(int[] data, OutputStream out) Writes data from the integer array to disk as raw bytes. byte[] b = new byte[4]; for (int word : data) { b[0] = (byte) ((word >>> 24) & 0xFF); b[1] = (byte) ((word >>> 16) & 0xFF); b[2] = (byte) ((word >>> 8) & 0xFF); b[3] = (byte) ((word >>> 0) & 0xFF); out.write(b); |
void | writeBytes(OutputStream os, byte[] b) write Bytes os.write(b, 0, b.length); |
void | writeBytes(OutputStream os, byte[] b) write Bytes os.write(toBytes(b.length));
if (b.length > 0) {
os.write(b);
os.flush();
|
void | writeBytes(OutputStream out, byte[] data) Write a byte array. writeVarInt(out, data.length); out.write(data); |
void | writeBytes(OutputStream output, Object value) write Bytes try { try (ObjectOutputStream out = new ObjectOutputStream(output)) { out.writeObject(value); } catch (IOException e) { throw new RuntimeException(e); |
void | writeBytes(OutputStream outputStream, byte[] data) write Bytes assert outputStream != null; try { outputStream.write(data); } finally { outputStream.close(); |
boolean | writeBytesToStream(byte[] bytes, OutputStream os, boolean printStackTraceOnError) Write the contents of a byte array to an OutputStream without needing to worry about exceptions. try { os.write(bytes); return true; } catch (IOException e) { if (printStackTraceOnError) { e.printStackTrace(); return false; ... |