Obtenir le nombre d’octet d’un document web avec ‘getContentLength’

Author:

 url, date, url, java
{filelink=9053}

import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Date;

public class WebLength
{
  public static void main(String args[]) throws Exception {
    URL url = new URL("http://www.exemple.com");
    HttpURLConnection conn = (HttpURLConnection) url.openConnection();

    int taille_oct = conn.getContentLength();
    if (taille_oct>=0)
      System.out.println("Content-Length: " + taille_oct);
 }
}

A Voir sur le même Sujet:

  • lire un fichier à partir du enieme octet java
  • class URLInfo java
  • javax.net.ssl exemple de code
  • size of nombre doctet
  • combien d'octets a une page web
  • site web, nombre d'octets
  • php afficher le nombre d'octes d'une page web
  • calculer le nombre d'octet d'une chaine java
  • calcul d'octets d'un fichier

Leave a Reply

Your email address will not be published. Required fields are marked *