• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

print writer

 
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello there,
I am trying to use below code to use print writer ,
import java.io.*;
import java.net.*;
import java.awt.event.*;
import java.awt.*;
import java.applet.*;

public class OutPut extends Applet
{

public void init()
{
try{

URL url = new URL("http://server1/vippast/hello.txt";);
URLConnection urlcon = url.openConnection();
urlcon.setDoOutput(true);
ByteArrayOutputStream baos = new ByteArrayOutputStream(512);
PrintWriter pt = new PrintWriter(baos,true);
String str = "this is output applet " ;
pt.println(str);
pt.flush();
pt.close();
baos.close();

System.out.println("printwriter printed to " + url + ";" + str);
}
catch(Exception e)
{
System.out.println(e.getMessage());
}
}
}
do I have to save "hello.txt" file on server1 or this program creates it , where does "printwriter.print(string) " statement produces result , in "hello.txt" ?
thanks


[This message has been edited by ray bond (edited November 17, 2000).]
 
No matter how many women are assigned to the project, a pregnancy takes nine months. Much longer than this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic