【发布时间】:2013-07-05 16:38:24
【问题描述】:
我正在尝试使用 Google 云存储客户端库将字节数组“上传”到本地 GAE/J(1.8.1,Eclipse Juno)开发服务器:
byte[] byteContent = new byte[] {1, 2, 3, 4, 5};
GcsFilename fileName = new GcsFilename("MyBucket", "foo");
GcsOutputChannel outputChannel =
GcsServiceFactory.createGcsService().createOrReplace(fileName, GcsFileOptions.getDefaultInstance());
outputChannel.write(ByteBuffer.wrap(byteContent));
outputChannel.close();
尝试这样做,会抛出以下异常:
WARNING: Caught IOException while attempting to write blob
java.io.FileNotFoundException: C:\dev\workspace\gaeTestProjekt\war\WEB-INF\appengine-generated\encoded_gs_key:L2dzL015QnVja2V0L2Zvbw (The filename, directory name, or volume label syntax is incorrect)
考虑到目标文件的名称中存在一个额外的冒号 (encoded_gs_key:L2dzL015QnVja2V0L2Zvbw),这是有道理的。
问题是,如何防止本地开发服务器尝试创建无效文件名?
【问题讨论】:
-
您使用的是哪个操作系统?我使用的是 Windows 7 64 位,文件保存在磁盘上,但 Windows shell 或命令提示符都无法浏览。
-
我遇到了同样的问题。有关此问题的任何更新?
标签: java google-app-engine google-cloud-storage