code: public byte[] getBytes() throws IOException {
          if(cachedData == null){
              if(getReader().available() > 0) {
                  cachedData = getReader().read();
              }
              else{
                  cachedData = new byte[0];
              }
          }
          return cachedData;
      }
docs: Get all the bytes (byte-array) available in the serial data receive buffer
  
  @return byte array containing all bytes available in serial data receive buffer
  @throws IOException