如何使用SAE的Storage

转自:http://blog.csdn.net/xujainxing/article/details/8981904

Storage在里面当然可以创建文件夹,只不过无法通过代码创建,而是在后台管理页面中的storage来创建的。下面这个例子演示了如何读取Storage中的文件:

注:我的domain叫做mytestapp02,里面有一个叫做hello的文件夹:

[java] view plaincopy
 
  1. <span style="font-size:24px;">  public void storageTest(){  
  2.        String domain="mytestapp02";  
  3.        String path="/hello/test.txt";  
  4.        SaeStorage saeStorage=new SaeStorage();  
  5.   
  6.        saeStorage.write(domain, path, "hello,sae!!!!!");  
  7.        byte[] b=saeStorage.read(domain, path);  
  8.        System.out.println(new String(b));  
  9.         
  10.    }  
  11. }</span>  



在SAE文档中,第二个参数是filename,其实准确的说应该是文件路径。

原文地址:https://www.cnblogs.com/x_wukong/p/3724663.html