package sun.net.www.protocol.chargen;
import java.net.*;
import java.io.*;
public class chargenURLConnection extends URLConnection {
Socket theConnection = null;
public final static int defaultPort = 19;
public chargenURLConnection(URL u) {
super(u);
}
public synchronized InputStream getInputStream() throws IOException {
if (!connected) {
connect();
}
return theConnection.getInputStream();
}
public String getContentType() {
return "text/plain";
}
public synchronized void connect() throws IOException {
int port;
if (!connected) {
port = url.getPort();
if ( port < 0) {
port = defaultPort;
}
theConnection = new Socket(url.getHost(), port);
connected = true;
}
}
}
|