FileDocCategorySizeDatePackage
FingerURLConnection.javaAPI DocExample1378Sat Sep 09 20:53:50 BST 2000com.macfaq.net.www.protocol.finger

FingerURLConnection

public class FingerURLConnection extends URLConnection

Fields Summary
private Socket
connection
public static final int
DEFAULT_PORT
Constructors Summary
public FingerURLConnection(URL u)


     
    super(u);
  
Methods Summary
public synchronized voidconnect()

  
    if (!connected) {
      int port = url.getPort();
      if ( port < 1 || port > 65535) {
        port = DEFAULT_PORT;
      }
      this.connection = new Socket(url.getHost(), port);
      OutputStream out = this.connection.getOutputStream();
      String names = url.getFile();
      if (names != null && !names.equals("")) {
        // delete initial /
        names = names.substring(1);
        names = URLDecoder.decode(names);
        byte[] result;
        try {
          result = names.getBytes("ASCII");
        }
        catch (UnsupportedEncodingException e) {
          result = names.getBytes();  
        }
        out.write(result);
      }
      out.write('\r");
      out.write('\n");
      out.flush();
      this.connected = true;
    } 
      
  
public java.lang.StringgetContentType()

    return "text/plain";
  
public synchronized java.io.InputStreamgetInputStream()

  
    if (!connected) this.connect();
    InputStream in = this.connection.getInputStream();
    return in;