List of utility methods to do File Write via ByteBuffer
int | writeFileNIO(String txt, File fyl) Write a file using NIO. return writeFileNIO(txt.getBytes(), fyl);
|
void | writeFloat(OutputStream os, float val, ByteOrder bo) Write a float to the OutputStream pointer respectively. ByteBuffer bb = ByteBuffer.allocate(Float.SIZE / 8);
bb.order(bo);
bb.putFloat(val);
os.write(bb.array());
|
void | writeInt(OutputStream os, int val, ByteOrder bo) Write an int to the OutputStream and advance the stream pointer respectively. ByteBuffer bb = ByteBuffer.allocate(Integer.SIZE / 8);
bb.order(bo);
bb.putInt(val);
os.write(bb.array());
|
void | writeInt(OutputStream out, ByteOrder order, int i) write Int ByteBuffer buf = ByteBuffer.allocate(4); buf.order(order); buf.putInt(i); out.write(buf.array(), buf.arrayOffset(), 4); |
void | writeInt(OutputStream out, int i) write Int byte[] bytes = new byte[Integer.BYTES]; ByteBuffer.wrap(bytes).putInt(i); out.write(bytes); |
long | writeInt(WritableByteChannel channel, int val) write Int ByteBuffer buf = ByteBuffer.allocate(4); buf.putInt(val); buf.rewind(); return writeByteBuffer(channel, buf, 4); |
void | writeInt(WritableByteChannel channel, int value) Wrtie an integer value to a channel. ByteBuffer buf = ByteBuffer.allocate(4); buf.putInt(value); buf.flip(); int count = 0; while (count < 4) { int n = 0; while (n == 0) n = channel.write(buf); ... |
void | writeInt(WritableByteChannel channel, int value) Writes an integer (32 bit) to the specified byte channel. ByteBuffer bb4 = getByteBuffer(4); bb4.position(0); bb4.putInt(value); bb4.position(0); for (int cnt = 0; cnt < 4;) { int n = channel.write(bb4); cnt += n; |
void | writeLong(OutputStream in, long i) Write the given int as a 8 byte long to the given outputStream. ByteBuffer bb = ByteBuffer.allocate(8); bb.putLong(i); in.write(bb.array()); |
void | writeLong(OutputStream os, Long d) write Long os.write(LONG); byte[] b = new byte[8]; ByteBuffer.wrap(b).putLong(d); os.write(b); |