extensions/net.sf.basedb.opengrid/trunk/src/net/sf/basedb/opengrid/filetransfer/StringUploadSource.java

Code
Comments
Other
Rev Date Author Line
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 7   Upload source implementation for uploading the contents
4121 22 Sep 16 nicklas 8   of a string to a file on a remote server.
4121 22 Sep 16 nicklas 9
4121 22 Sep 16 nicklas 10   @author nicklas
4121 22 Sep 16 nicklas 11   @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 18     Create a new source file from a string of data. The string is
4121 22 Sep 16 nicklas 19     converted to a byte[] using UTF-8 before the transfer. If another
4121 22 Sep 16 nicklas 20     encoding is required use the {@link ByteArrayUploadSource} 
4121 22 Sep 16 nicklas 21     instead.
4121 22 Sep 16 nicklas 22     
4121 22 Sep 16 nicklas 23     @param name The name of the "file"
4121 22 Sep 16 nicklas 24     @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 }