Guest User

Untitled

a guest
Nov 22nd, 2017
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. String thisurl ="http://songolum.com/file/ppdVkTxqhwcJu-CAzCgtNeICMi8mHZnKQBgnksb5o2Q/Ed%2BSheeran%2B-%2BPerfect.mp3?r=idz&dl=311&ref=ed-sheran-perfect";
  2. URL url = null;
  3. try {
  4. url = new URL(thisurl);
  5.  
  6. HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
  7. try {
  8. // urlConnection.setRequestProperty("Transfer-Encoding", "chunked");
  9. urlConnection.setRequestProperty("Accept-Encoding", "identity");
  10. urlConnection.setDoOutput(true);
  11. urlConnection.setChunkedStreamingMode(0);
  12.  
  13. int l=0;
  14. InputStream in = new BufferedInputStream(urlConnection.getInputStream());
  15. while(in.read()!=-1)
  16. {
  17. l=l+in.read();
  18. }
  19. System.out.println("Content-length" +l);
Add Comment
Please, Sign In to add comment