code: public static void transfer(URLConnection c, byte[] bytes) throws IOException
      {
          try (OutputStream out = new BufferedOutputStream(c.getOutputStream()))
          {
              out.write(bytes);
          }
      }
docs: Transfers a byte[] to the output stream of a URLConnection
  @param c  Connection to transfer output
  @param bytes the bytes to send
  @throws IOException