當前位置: 首頁>>代碼示例>>Java>>正文


Java GSFileOptionsBuilder類代碼示例

本文整理匯總了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();
}
 
開發者ID:steveseo,項目名稱:l2bq,代碼行數:21,代碼來源:AnalysisUtility.java

示例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();
	}
}
 
開發者ID:dataiku,項目名稱:wt1,代碼行數:23,代碼來源:TestServlet.java

示例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();
}
 
開發者ID:steveseo,項目名稱:l2bq,代碼行數:12,代碼來源:FancyFileWriter.java

示例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());
}
 
開發者ID:dataiku,項目名稱:wt1,代碼行數:10,代碼來源:GCSGAEStorageProcessor.java


注:本文中的com.google.appengine.api.files.GSFileOptions.GSFileOptionsBuilder類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。