Sending binary data with HttpURLConnection
问题 i want to use google speech api, i've found this https://github.com/gillesdemey/google-speech-v2/ where everything is explained well, but and im trying to rewrite it into java. File filetosend = new File(path); byte[] bytearray = Files.readAllBytes(filetosend); URL url = new URL("https://www.google.com/speech-api/v2/recognize?output="+outputtype+"&lang="+lang+"&key="+key); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); //method conn.setRequestMethod("POST"); //header conn