1 /*****************************************************/
\r
2 /* This java file is a part of the */
\r
4 /* - Plouf's Java IRC Client - */
\r
6 /* Copyright (C) 2002 - 2004 Philippe Detournay */
\r
8 /* All contacts : theplouf@yahoo.com */
\r
10 /* PJIRC is free software; you can redistribute */
\r
11 /* it and/or modify it under the terms of the GNU */
\r
12 /* General Public License as published by the */
\r
13 /* Free Software Foundation; version 2 or later of */
\r
16 /* PJIRC is distributed in the hope that it will */
\r
17 /* be useful, but WITHOUT ANY WARRANTY; without */
\r
18 /* even the implied warranty of MERCHANTABILITY or */
\r
19 /* FITNESS FOR A PARTICULAR PURPOSE. See the GNU */
\r
20 /* General Public License for more details. */
\r
22 /* You should have received a copy of the GNU */
\r
23 /* General Public License along with PJIRC; if */
\r
24 /* not, write to the Free Software Foundation, */
\r
25 /* Inc., 59 Temple Place, Suite 330, Boston, */
\r
26 /* MA 02111-1307 USA */
\r
28 /*****************************************************/
\r
30 package irc.security;
\r
32 import java.io.File;
\r
33 import java.io.FileInputStream;
\r
34 import java.io.FileOutputStream;
\r
35 import java.io.IOException;
\r
36 import java.net.InetAddress;
\r
37 import java.net.ServerSocket;
\r
38 import java.net.Socket;
\r
39 import java.net.UnknownHostException;
\r
42 * Provide methods for accessing protected operations.
\r
44 public interface SecuredProvider {
\r
52 * @throws UnknownHostException
\r
53 * is host is not found.
\r
54 * @throws IOException
\r
55 * if an error occurs.
\r
56 * @return a new Socket.
\r
58 public Socket getSocket(String host, Integer port) throws UnknownHostException, IOException;
\r
61 * Get a new ServerSocket.
\r
65 * @return the created server socket.
\r
66 * @throws IOException
\r
67 * if an error occurs.
\r
69 public ServerSocket getServerSocket(Integer port) throws IOException;
\r
72 * Get an FileInputStream from a local file.
\r
76 * @throws IOException
\r
77 * if an error occurs.
\r
78 * @return an FileInputStream from the file.
\r
80 public FileInputStream getFileInputStream(File file) throws IOException;
\r
83 * Get an FileOutputStream to a local file.
\r
87 * @throws IOException
\r
88 * if an error occurs.
\r
89 * @return an FileOutputStream from the file.
\r
91 public FileOutputStream getFileOutputStream(File file) throws IOException;
\r
94 * Get the file size.
\r
97 * the file to get size.
\r
98 * @return the file size, of a negative value if not able.
\r
100 public Integer getFileSize(File file);
\r
103 * Open a load file dialog with the given title and return the user choice.
\r
107 * @return user choice.
\r
109 public File getLoadFile(String title);
\r
112 * Open a save file dialog with the given title and return the user choice.
\r
116 * @return user choice.
\r
118 public File getSaveFile(String title);
\r
121 * Open a save file dialog with the given title and return the user choice.
\r
127 * @return user choice.
\r
129 public File getSaveFile(String file, String title);
\r
132 * Get the local host address.
\r
134 * @return local host address.
\r
135 * @throws UnknownHostException
\r
138 public InetAddress getLocalHost() throws UnknownHostException;
\r
141 * Perform a dns resolve of the given address.
\r
144 * address to resolve.
\r
145 * @return resolved address.
\r
147 public String resolve(InetAddress addr);
\r
150 * Try to use this provider. Return false if this provider is not able to
\r
151 * perform its task.
\r
153 * @return true if this provider can be used, false otherwise.
\r
155 public boolean tryProvider();
\r
158 * Get this provider's name.
\r
160 * @return the provder name.
\r
162 public String getName();
\r