public synchronized static void write(int fd, ByteBuffer ... data) throws IOException{

        // write each byte buffer to the serial port
        for(ByteBuffer single : data) {

            // read the byte buffer from the current position up to the limit
            byte[] payload = new byte[single.remaining()];
            single.get(payload);

            // write the data contents to the serial port via JNI native method
            write(fd, payload, payload.length);
        }
    }
public synchronized static void write ( int fd , ByteBuffer ... data ) throws IOException { for ( ByteBuffer single : data ) { byte [ ] payload = new byte [ single . remaining ( ) ] ; single . get ( payload ) ; write ( fd , payload , payload . length ) ; } }
Read the content of byte buffer and write the data to the serial port transmit buffer.
(The buffer is read from the current position up to the 'limit' value, not the 'capacity'.  You may need to
rewind() or flip() the byte buffer if you have just written to it.)

@param fd
The file descriptor of the serial port/device.
@param data
A ByteBuffer of data to be transmitted.