irc.security
Interface SecuredProvider

All Known Implementing Classes:
DefaultSecuredProvider, SpecificMSSecuredProvider, SpecificSUNSecuredProvider

public interface SecuredProvider

Provide methods for accessing protected operations.


Method Summary
 java.io.FileInputStream getFileInputStream(java.io.File file)
          Get an FileInputStream from a local file.
 java.io.FileOutputStream getFileOutputStream(java.io.File file)
          Get an FileOutputStream to a local file.
 int getFileSize(java.io.File file)
          Get the file size.
 java.io.File getLoadFile(java.lang.String title)
          Open a load file dialog with the given title and return the user choice.
 java.net.InetAddress getLocalHost()
          Get the local host address.
 java.lang.String getName()
          Get this provider's name.
 java.io.File getSaveFile(java.lang.String title)
          Open a save file dialog with the given title and return the user choice.
 java.net.ServerSocket getServerSocket(int port)
          Get a new ServerSocket.
 java.net.Socket getSocket(java.lang.String host, int port)
          Get a new Socket.
 java.lang.String resolve(java.net.InetAddress addr)
          Perform a dns resolve of the given address.
 boolean tryProvider()
          Try to use this provider.
 

Method Detail

getSocket

public java.net.Socket getSocket(java.lang.String host,
                                 int port)
                          throws java.net.UnknownHostException,
                                 java.io.IOException
Get a new Socket.

Parameters:
host - server host.
port - server port.
Returns:
a new Socket.
Throws:
java.net.UnknownHostException - is host is not found.
java.io.IOException - if an error occurs.

getServerSocket

public java.net.ServerSocket getServerSocket(int port)
                                      throws java.io.IOException
Get a new ServerSocket.

Parameters:
port - local port.
Throws:
java.io.IOException - if an error occurs.

getFileInputStream

public java.io.FileInputStream getFileInputStream(java.io.File file)
                                           throws java.io.IOException
Get an FileInputStream from a local file.

Parameters:
file - the local file.
Returns:
an FileInputStream from the file.
Throws:
java.io.IOException - if an error occurs.

getFileOutputStream

public java.io.FileOutputStream getFileOutputStream(java.io.File file)
                                             throws java.io.IOException
Get an FileOutputStream to a local file.

Parameters:
file - the local file.
Returns:
an FileOutputStream from the file.
Throws:
java.io.IOException - if an error occurs.

getFileSize

public int getFileSize(java.io.File file)
Get the file size.

Parameters:
file - the file to get size.
Returns:
the file size, of a negative value if not able.

getLoadFile

public java.io.File getLoadFile(java.lang.String title)
Open a load file dialog with the given title and return the user choice.

Parameters:
title - dialog title.
Returns:
user choice.

getSaveFile

public java.io.File getSaveFile(java.lang.String title)
Open a save file dialog with the given title and return the user choice.

Parameters:
title - dialog title.
Returns:
user choice.

getLocalHost

public java.net.InetAddress getLocalHost()
                                  throws java.net.UnknownHostException
Get the local host address.

Returns:
local host address.
Throws:
java.net.UnknownHostException - if error occurs.

resolve

public java.lang.String resolve(java.net.InetAddress addr)
Perform a dns resolve of the given address.

Parameters:
addr - address to resolve.
Returns:
resolved address.

tryProvider

public boolean tryProvider()
Try to use this provider. Return false if this provider is not able to perform its task.

Returns:
true if this provider can be used, false otherwise.

getName

public java.lang.String getName()
Get this provider's name.

Returns:
the provder name.