我正在使用 App Engine(版本 1.4.3)直接写入 blobstore以保存图像。当我尝试存储大于 1MB 的图像时,出现以下异常
com.google.apphosting.api.ApiProxy$RequestTooLargeException: The request to API call datastore_v3.Put() was too large.
我以为每个对象的限制是 2GB
这是存储图像的Java代码
private void putInBlobStore(final String mimeType, final byte[] data) throws IOException {
final FileService fileService = FileServiceFactory.getFileService();
final AppEngineFile file = fileService.createNewBlobFile(mimeType);
final FileWriteChannel writeChannel = fileService.openWriteChannel(file, true);
writeChannel.write(ByteBuffer.wrap(data));
writeChannel.closeFinally();
}