FileDocCategorySizeDatePackage
CryptURLConnection.javaAPI DocExample1748Sat Apr 23 22:35:36 BST 2005learningjava.protocolhandlers.crypt

CryptURLConnection

public class CryptURLConnection extends URLConnection

Fields Summary
static int
defaultPort
learningjava.protocolhandlers.crypt.CryptInputStream
cis
Constructors Summary
public CryptURLConnection(URL url, String crypType)

        super( url );
        try {
            String classname = "learningjava.protocolhandlers.crypt."
                + crypType + "CryptInputStream";
            cis = (CryptInputStream)
                   Class.forName(classname).newInstance(  );
        } catch ( Exception e ) {
            throw new IOException("Crypt Class Not Found: "+e);
        }
    
Methods Summary
public voidconnect()

        int port = ( url.getPort(  ) == -1 ) ?
                     defaultPort : url.getPort(  );
        Socket s = new Socket( url.getHost(  ), port );

        // Send the filename in plaintext
        OutputStream server = s.getOutputStream(  );
        new PrintWriter( new OutputStreamWriter( server, "8859_1" ),
                         true).println( "GET " + url.getFile(  ) );

        // Initialize the CryptInputStream
        cis.set( s.getInputStream(  ), server );
        connected = true;
    
public java.lang.StringgetContentType()


         
        return guessContentTypeFromName( url.getFile(  ) );
    
public java.io.InputStreamgetInputStream()

        if (!connected)
            connect(  );
        return ( cis );