1107 |
03 Jun 09 |
nicklas |
1 |
package net.sf.basedb.genepattern.file; |
1107 |
03 Jun 09 |
nicklas |
2 |
|
1107 |
03 Jun 09 |
nicklas |
3 |
import java.io.IOException; |
1107 |
03 Jun 09 |
nicklas |
4 |
import java.io.InputStream; |
1107 |
03 Jun 09 |
nicklas |
5 |
import java.io.OutputStream; |
1107 |
03 Jun 09 |
nicklas |
6 |
|
1107 |
03 Jun 09 |
nicklas |
7 |
/** |
1107 |
03 Jun 09 |
nicklas |
A proxy for a file that is going to be used by a GenePattern job. |
1107 |
03 Jun 09 |
nicklas |
Files are added to {@link FileTransferGateway#addFile(String, FileProxy)}. |
1107 |
03 Jun 09 |
nicklas |
<p> |
1107 |
03 Jun 09 |
nicklas |
Implementors of this interface may choose if they want to implement |
1107 |
03 Jun 09 |
nicklas |
{@link #getInputStream()} or {@link #writeTo(OutputStream)}. If the |
1107 |
03 Jun 09 |
nicklas |
<code>getInputStream()</code> method returns a non-null object that |
1107 |
03 Jun 09 |
nicklas |
stream is used for copying the file. The <code>writeTo()</code> |
1107 |
03 Jun 09 |
nicklas |
method is only used if <code>getInputStream()</code> return null. |
1107 |
03 Jun 09 |
nicklas |
16 |
|
1107 |
03 Jun 09 |
nicklas |
@author nicklas |
1107 |
03 Jun 09 |
nicklas |
@since 1.0 |
1107 |
03 Jun 09 |
nicklas |
19 |
*/ |
1107 |
03 Jun 09 |
nicklas |
20 |
public interface FileProxy |
1107 |
03 Jun 09 |
nicklas |
21 |
{ |
1107 |
03 Jun 09 |
nicklas |
22 |
/** |
1107 |
03 Jun 09 |
nicklas |
Get the name of the file. |
1107 |
03 Jun 09 |
nicklas |
24 |
*/ |
1107 |
03 Jun 09 |
nicklas |
25 |
public String getFileName(); |
1107 |
03 Jun 09 |
nicklas |
26 |
|
1107 |
03 Jun 09 |
nicklas |
27 |
/** |
1107 |
03 Jun 09 |
nicklas |
Get an input stream for reading the file data. May |
1107 |
03 Jun 09 |
nicklas |
return null if the implementation can't supply an input stream |
1107 |
03 Jun 09 |
nicklas |
but then {@link #writeTo(OutputStream)} must be implemented instead. |
1107 |
03 Jun 09 |
nicklas |
@return An input stream or null |
1107 |
03 Jun 09 |
nicklas |
32 |
*/ |
1107 |
03 Jun 09 |
nicklas |
33 |
public InputStream getInputStream() |
1107 |
03 Jun 09 |
nicklas |
34 |
throws IOException; |
1107 |
03 Jun 09 |
nicklas |
35 |
|
1107 |
03 Jun 09 |
nicklas |
36 |
/** |
1107 |
03 Jun 09 |
nicklas |
Write the file data to the given output stream. This method only needs |
1107 |
03 Jun 09 |
nicklas |
to be implemented if the {@link #getInputStream()} returns null. |
1107 |
03 Jun 09 |
nicklas |
@param out The output stream to write the file data to |
1107 |
03 Jun 09 |
nicklas |
40 |
*/ |
1107 |
03 Jun 09 |
nicklas |
41 |
public void writeTo(OutputStream out) |
1107 |
03 Jun 09 |
nicklas |
42 |
throws IOException; |
1107 |
03 Jun 09 |
nicklas |
43 |
} |