本文整理匯總了Java中org.globus.io.streams.GridFTPOutputStream類的典型用法代碼示例。如果您正苦於以下問題:Java GridFTPOutputStream類的具體用法?Java GridFTPOutputStream怎麽用?Java GridFTPOutputStream使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
GridFTPOutputStream類屬於org.globus.io.streams包,在下文中一共展示了GridFTPOutputStream類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: doGetOutputStream
import org.globus.io.streams.GridFTPOutputStream; //導入依賴的package包/類
/**
* Creates an output stream to write the file content to.
*
* @param bAppend the b append
*
* @return the output stream
*
* @throws Exception the exception
*/
@Override
protected OutputStream doGetOutputStream(boolean bAppend) throws Exception {
// String Path = relPath;
log.debug("Creating FTP Output Stream to host:" + GsiFtpClientFactory.port + ":" + GsiFtpClientFactory.port + " Abs path:"
+ getName().getPath() + " Append:" + bAppend);
// if ( ! relPath.startsWith("/")) {
// Path = "/" + Path;
// log.warn("Relative path " + relPath + " doesn't start with /. Using:" + Path + " instead");
// }
return new GridFTPOutputStream(null, GsiFtpClientFactory.host, GsiFtpClientFactory.port, getName().getPath(), bAppend);
// log.debug("Creating FTP Output stream: Unimplemented");
// throw new Exception("Unimplemented");
// final FtpClient client = ftpFs.getClient();
// OutputStream out = null;
// if (bAppend)
// {
// out = client.appendFileStream(relPath);
// }
// else
// {
// out = client.storeFileStream(relPath);
// }
//
// if (out == null)
// {
// throw new FileSystemException("vfs.provider.ftp/output-error.debug", new Object[]
// {
// this.getName(),
// client.getReplyString()
// });
// }
//
// return new FtpOutputStream(client, out);
}
示例2: openUrl
import org.globus.io.streams.GridFTPOutputStream; //導入依賴的package包/類
protected OutputStream openUrl(GlobusURL url)
throws Exception {
String protocol = url.getProtocol();
if (protocol.equalsIgnoreCase("https")) {
return new GassOutputStream(_credential,
SelfAuthorization.getInstance(),
url.getHost(),
url.getPort(),
url.getPath(),
-1,
appendStdout);
} else if (protocol.equalsIgnoreCase("http")) {
return new HTTPOutputStream(url.getHost(),
url.getPort(),
url.getPath(),
-1,
appendStdout);
} else if (protocol.equalsIgnoreCase("gsiftp") ||
protocol.equalsIgnoreCase("gridftp")) {
return new GridFTPOutputStream(_credential,
HostAuthorization.getInstance(),
url.getHost(),
url.getPort(),
url.getPath(),
appendStdout,
true);
} else if (protocol.equalsIgnoreCase("ftp")) {
return new FTPOutputStream(url.getHost(),
url.getPort(),
url.getUser(),
url.getPwd(),
url.getPath(),
appendStdout);
} else {
throw new Exception("Protocol not supported: " + protocol);
}
}