Tema: Servicio WEB
Ver Mensaje Individual
  #4 (permalink)  
Antiguo 30/09/2008, 09:37
chemajf
 
Fecha de Ingreso: julio-2008
Mensajes: 39
Antigüedad: 15 años, 9 meses
Puntos: 0
Pregunta Respuesta: Servicio WEB

Algo asi:

public static void getPDF(String url) throws Exception {
URL url = new URL(url);
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
String total = "";
String inputLine;
while ((inputLine = in.readLine()) != null){
total += inputLine;
}
in.close();

String nombreArchivo = "C:/pepe.pdf";

FileWriter fw = null;
try {
fw = new FileWriter(nombreArchivo);
BufferedWriter bw = new BufferedWriter(fw);
PrintWriter salArch = new PrintWriter(bw);

salArch.print(total);

} catch (IOException ex) {
System.out.println("Fallito");
}

}