本文整理汇总了Java中com.github.sardine.Sardine.get方法的典型用法代码示例。如果您正苦于以下问题:Java Sardine.get方法的具体用法?Java Sardine.get怎么用?Java Sardine.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.github.sardine.Sardine
的用法示例。
在下文中一共展示了Sardine.get方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: get
import com.github.sardine.Sardine; //导入方法依赖的package包/类
@Override
public InputStream get(String remotePath) throws Throwable {
String url = PathUtil.join(_serverAddress, remotePath);
String uri = URIEncoder.encode(url);
Sardine sardine = getSardineInstance();
InputStream in = null;
try {
in = sardine.get(uri);
} finally {
sardine.shutdown();
}
return in;
}
示例2: getConfigData
import com.github.sardine.Sardine; //导入方法依赖的package包/类
@Override
public String getConfigData( String component, String feature ) throws Exception
{
if(component == null)
{
throw new Exception("Component is invalid");
}
else if(feature == null)
{
throw new Exception("Feature is not valid");
}
else
{
String componentUrl = "" + getProjectUrl() + "/" + component + "/" + feature + "/config.json";
String configResource = "";
if(projectExists(componentUrl))
{
Sardine method = SardineFactory.begin(apiUserName, apiPassword);
try
{
InputStream is = method.get(componentUrl);
BufferedReader i = new BufferedReader(new InputStreamReader(is, "8859_1") );
int numBytes;
char[] buff = new char[512];
while((numBytes = i.read(buff))!=-1)
{
configResource += String.copyValueOf(buff, 0, numBytes);
}
}
catch ( IOException ioe )
{
String error = "Could not get config data because: " + ioe.getMessage();
throw new Exception( error, ioe );
}
}
else
{
return "no_config";
}
return configResource;
}
}
示例3: getDefaultConfigData
import com.github.sardine.Sardine; //导入方法依赖的package包/类
@Override
public String getDefaultConfigData ( String component, String feature ) throws Exception
{
if(component == null)
{
throw new Exception("Component is invalid");
}
else if(feature == null)
{
throw new Exception("Feature is not valid");
}
else
{
String componentUrl = "" + apiDefaultPath + "/" + component + "/" + feature + "/config.json";
String configResource = "";
if(projectExists(componentUrl))
{
Sardine method = SardineFactory.begin(apiUserName, apiPassword);
try
{
InputStream is = method.get(componentUrl);
BufferedReader i = new BufferedReader(new InputStreamReader(is, "8859_1") );
int numBytes;
char[] buff = new char[512];
while((numBytes = i.read(buff))!=-1)
{
configResource += String.copyValueOf(buff, 0, numBytes);
}
}
catch ( IOException ioe )
{
String error = "Could not get config data because: " + ioe.getMessage();
throw new Exception( error, ioe );
}
}
else
{
return "no_config";
}
return configResource;
}
}
示例4: getDocument
import com.github.sardine.Sardine; //导入方法依赖的package包/类
@Override
public String getDocument(String filePath) throws Exception
{
if(filePath == null)
{
throw new Exception("The file path is invalid");
}
else
{
try {
String fileURL = "" + apiRepositoryUrl + filePath;
if(projectExists(fileURL))
{
Sardine method = SardineFactory.begin(apiUserName, apiPassword);
InputStream is = method.get(fileURL);
BufferedReader i = new BufferedReader(new InputStreamReader(is, "8859_1"));
String resource = "";
int numBytes;
char[] buff = new char[512];
while((numBytes = i.read(buff))!=-1)
{
resource += String.copyValueOf(buff, 0, numBytes);
}
return resource;
}
else
{
throw new Exception("The project configuration file does not exist");
}
}
catch (IOException ioe)
{
String error = "Could not retrieve the document because : " + ioe.getMessage();
throw new Exception( error, ioe );
}
}
}