当前位置: 首页>>代码示例>>Java>>正文


Java Sardine.get方法代码示例

本文整理汇总了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;
}
 
开发者ID:uom-daris,项目名称:daris,代码行数:14,代码来源:WebdavClientImpl.java

示例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;
    }
}
 
开发者ID:it-innovation,项目名称:EXPERImonitor,代码行数:48,代码来源:ECCConfigAPIImpl.java

示例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;
   }
    
}
 
开发者ID:it-innovation,项目名称:EXPERImonitor,代码行数:49,代码来源:ECCConfigAPIImpl.java

示例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 );
         }
          
     }
}
 
开发者ID:it-innovation,项目名称:EXPERImonitor,代码行数:45,代码来源:ECCConfigAPIImpl.java


注:本文中的com.github.sardine.Sardine.get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。