Code example for SocketPermission

0
    public Permission getPermission() throws IOException {
        int port = url.getPort();
        if (port <= 0) {
            port = FTP_PORT;
        } 
        return new SocketPermission(hostName + ":" + port, "connect, resolve"); //$NON-NLS-1$ //$NON-NLS-2$
    } 
 
    /** 
     * Creates a output stream for writing to this URL Connection. 
     *  
     * @return The output stream to write to 
     * @throws IOException 
     *             when the OutputStream could not be created 
     *  
     * @see #getContent() 
     * @see #getInputStream() 
     * @see java.io.IOException 
     *  
     */ 
    @Override