See on Tõrva Gümnaasiumi vana veebilehe arhiiv. Uus veebileht: https://torva.edu.ee/

SecurityProvider (PJIRC project)

Lisamaterjalide loend

Algne fail: vana_veeb/pjirc/doc/javadoc/irc/security/SecurityProvider.html.

========== START OF NAVBAR ==========
=========== END OF NAVBAR ===========
======== START OF CLASS DATA ========

irc.security
Class SecurityProvider

java.lang.Object
  |
  +--irc.security.SecurityProvider

public class SecurityProvider
extends java.lang.Object

The security provider. Provides an interface for accessing protected data or operation.


Constructor Summary
protected SecurityProvider()
          Internally used.
 
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 getProviderName()
          Get the used provider name.
 java.io.File getSaveFile(java.lang.String title)
          Open a save file dialog with the given title and return the user choice.
static SecurityProvider getSecurityProvider()
          Get the used security provider.
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SecurityProvider

protected SecurityProvider()
Internally used.

Method Detail

getSecurityProvider

public static final SecurityProvider getSecurityProvider()
Get the used security provider.

Returns:
the security provider to use.


getProviderName

public java.lang.String getProviderName()
Get the used provider name.

Returns:
used provider name.


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.