本文整理汇总了Java中com.google.appengine.api.files.GSFileOptions.GSFileOptionsBuilder类的典型用法代码示例。如果您正苦于以下问题:Java GSFileOptionsBuilder类的具体用法?Java GSFileOptionsBuilder怎么用?Java GSFileOptionsBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GSFileOptionsBuilder类属于com.google.appengine.api.files.GSFileOptions包,在下文中一共展示了GSFileOptionsBuilder类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: writeSchema
import com.google.appengine.api.files.GSFileOptions.GSFileOptionsBuilder; //导入依赖的package包/类
public static void writeSchema(FileService fileService, String bucketName, String schemaKey, List<String> fieldNames, List<String> fieldTypes) throws IOException,
FileNotFoundException, FinalizationException, LockException {
GSFileOptionsBuilder schemaOptionsBuilder = new GSFileOptionsBuilder()
.setBucket(bucketName)
.setKey(schemaKey)
.setAcl("project-private");
AppEngineFile schemaFile = fileService.createNewGSFile(schemaOptionsBuilder.build());
FileWriteChannel schemaChannel = fileService.openWriteChannel(schemaFile, true);
PrintWriter schemaWriter = new PrintWriter(Channels.newWriter(schemaChannel, "UTF8"));
StringBuilder sb = new StringBuilder();
for (int i = 0; i < fieldNames.size(); i++) {
sb.append(fieldNames.get(i) + ":" + fieldTypes.get(i));
if (i < fieldNames.size() - 1) {
sb.append(",");
}
}
schemaWriter.print(sb);
schemaWriter.close();
schemaChannel.closeFinally();
}
示例2: doGet
import com.google.appengine.api.files.GSFileOptions.GSFileOptionsBuilder; //导入依赖的package包/类
@Override
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
try {
System.out.println(newFileName());
FileService fileService = FileServiceFactory.getFileService();
GSFileOptionsBuilder optionsBuilder = new GSFileOptionsBuilder()
.setBucket("wt1-test1")
.setKey(newFileName());
AppEngineFile aef = fileService.createNewGSFile(optionsBuilder.build());
FileWriteChannel ch = fileService.openWriteChannel(aef, true);
Channels.newWriter(ch, "utf8").append("pouet").flush();
ch.closeFinally();
System.out.println("SUCCESS **************");
} catch (Exception e) {
System.out.println("FAILURE **************************");
e.printStackTrace();
}
}
示例3: FancyFileWriter
import com.google.appengine.api.files.GSFileOptions.GSFileOptionsBuilder; //导入依赖的package包/类
public FancyFileWriter(String bucketName, String fileKey) throws IOException {
lastOpenMillis = System.currentTimeMillis();
log.warning("Creating file " + bucketName + ":" + fileKey);
GSFileOptionsBuilder optionsBuilder = new GSFileOptionsBuilder()
.setBucket(bucketName)
.setKey(fileKey)
.setAcl("project-private");
logsFile = fileService.createNewGSFile(optionsBuilder.build());
init();
}
示例4: newFile
import com.google.appengine.api.files.GSFileOptions.GSFileOptionsBuilder; //导入依赖的package包/类
/**
* Create a new file on Cloud storage
*/
private AppEngineFile newFile(String name) throws IOException {
GSFileOptionsBuilder optionsBuilder = new GSFileOptionsBuilder()
.setBucket(bucketName)
.setKey(name);
return fileService.createNewGSFile(optionsBuilder.build());
}