List of utility methods to do ByteBuffer Write
void | writeDouble(double v, ByteBuffer buffer) write Double writeLong(Double.doubleToRawLongBits(v), buffer); |
void | writeEmpty(final ByteBuffer buffer, final int type) write Empty buffer.put((byte) type); buffer.put((byte) 0); |
void | writeFakeImageData(ByteBuffer out, int lzwMinCodeSize) write Fake Image Data verifyRemaining(out, 4); verifyShortValues(lzwMinCodeSize); out.put((byte) lzwMinCodeSize); out.put((byte) 0x01); out.put((byte) 0x01); out.put((byte) 0x00); |
void | writeFFloat(ByteBuffer buffer, float value) Writes a 4 byte float. buffer.putInt(Float.floatToIntBits(value)); |
File | writeFile(ByteBuffer data, File destination) write File try (FileChannel channel = FileChannel.open(destination.toPath(), StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING, StandardOpenOption.WRITE)) { channel.write(data); return destination; |
boolean | writeFile(File file, ByteBuffer bb) write File try { FileChannel wChannel = new FileOutputStream(file, false).getChannel(); wChannel.write(bb); wChannel.close(); return true; } catch (IOException e) { e.printStackTrace(); return false; |
void | writeFile(File file, ByteBuffer buffer) write File boolean created = file.createNewFile(); assert created : file; try (FileOutputStream fileWriter = new FileOutputStream(file)) { fileWriter.write(buffer.array(), 0, buffer.remaining()); |
boolean | writeFileFragment(FileChannel fc, long pos, ByteBuffer fragment) write File Fragment try { fc.position(pos); int size = fragment.remaining(); if (fc.write(fragment) != size) return false; fc.force(false); } catch (IOException ex) { ex.printStackTrace(); ... |
void | writeFloat(ByteBuffer buffer, float f) write Float writeInt(buffer, Float.floatToIntBits(f)); |
int | writeFromBuffer(SocketChannel channel, ByteBuffer buf, int sleepMsecs) write From Buffer if (channel == null || buf.limit() == 0) { return -1; int totWritten = 0; buf.rewind(); while (totWritten < buf.limit()) { int nWritten; try { ... |