public synchronized static void read(int fd, ByteBuffer buffer) throws IOException{
        byte[] data = read(fd);
        buffer.put(data);
    }
public synchronized static void read ( int fd , ByteBuffer buffer ) throws IOException { byte [ ] data = read ( fd ) ; buffer . put ( data ) ; }
<p>Reads all available bytes from the serial device into a provided ByteBuffer.</p>

@param fd
The file descriptor of the serial port/device.
@param buffer
The ByteBuffer object to write to.