4121 |
22 Sep 16 |
nicklas |
1 |
package net.sf.basedb.opengrid.filetransfer; |
4121 |
22 Sep 16 |
nicklas |
2 |
|
4121 |
22 Sep 16 |
nicklas |
3 |
import java.nio.charset.Charset; |
4121 |
22 Sep 16 |
nicklas |
4 |
|
4121 |
22 Sep 16 |
nicklas |
5 |
|
4121 |
22 Sep 16 |
nicklas |
6 |
/** |
4121 |
22 Sep 16 |
nicklas |
Upload source implementation for uploading the contents |
4121 |
22 Sep 16 |
nicklas |
of a string to a file on a remote server. |
4121 |
22 Sep 16 |
nicklas |
9 |
|
4121 |
22 Sep 16 |
nicklas |
@author nicklas |
4121 |
22 Sep 16 |
nicklas |
@since 1.0 |
4121 |
22 Sep 16 |
nicklas |
12 |
*/ |
4121 |
22 Sep 16 |
nicklas |
13 |
public class StringUploadSource |
4121 |
22 Sep 16 |
nicklas |
14 |
extends ByteArrayUploadSource |
4121 |
22 Sep 16 |
nicklas |
15 |
{ |
4121 |
22 Sep 16 |
nicklas |
16 |
|
4121 |
22 Sep 16 |
nicklas |
17 |
/** |
4121 |
22 Sep 16 |
nicklas |
Create a new source file from a string of data. The string is |
4121 |
22 Sep 16 |
nicklas |
converted to a byte[] using UTF-8 before the transfer. If another |
4121 |
22 Sep 16 |
nicklas |
encoding is required use the {@link ByteArrayUploadSource} |
4121 |
22 Sep 16 |
nicklas |
instead. |
4121 |
22 Sep 16 |
nicklas |
22 |
|
4121 |
22 Sep 16 |
nicklas |
@param name The name of the "file" |
4121 |
22 Sep 16 |
nicklas |
@param data The contents of the file, null is not allowed |
4121 |
22 Sep 16 |
nicklas |
25 |
*/ |
4121 |
22 Sep 16 |
nicklas |
26 |
public StringUploadSource(String name, String data) |
4121 |
22 Sep 16 |
nicklas |
27 |
{ |
4121 |
22 Sep 16 |
nicklas |
28 |
super(name, data.getBytes(Charset.forName("UTF-8"))); |
4121 |
22 Sep 16 |
nicklas |
29 |
} |
4121 |
22 Sep 16 |
nicklas |
30 |
|
4121 |
22 Sep 16 |
nicklas |
31 |
} |