I'm trying to use the new File/Blob API which was released in the
1.4.3 version.
I have no problem storing files 1MB.
for larger files I'm splitting the writting into smaller chunks of
800KB
private void putInBlobstore(String mt, byte[] data) throws Throwable {
final FileService fileService =
FileServiceFactory.getFileService();
final AppEngineFile file = fileService.createNewBlobFile(mt);
final FileWriteChannel writeChannel =
fileService.openWriteChannel(file, true);
int pos = 0;
final long dataLen = data.length;
while (pos dataLen) {
final int hm = (int) Math.min(dataLen - pos, 80);
final int actual = writeChannel.write(ByteBuffer.wrap(data, pos,
hm));
pos += actual;
}
writeChannel.closeFinally();
}
but it didn't work :-( I also tried to create different files for each
of the chunks (i.e. put file, and writeChannler creation inside the
loop),
private void putInBlobstore(String mt, byte[] data) throws Throwable {
int pos = 0;
final long dataLen = data.length;
while (pos dataLen) {
final FileService fileService =
FileServiceFactory.getFileService();
final AppEngineFile file = fileService.createNewBlobFile(mt);
final FileWriteChannel writeChannel =
fileService.openWriteChannel(file, true);
final int hm = (int) Math.min(dataLen - pos, 80);
final int actual = writeChannel.write(ByteBuffer.wrap(data, pos,
hm));
pos += actual;
}
writeChannel.closeFinally();
}
but it didn't work as well :-(
Can you please elaborate the term 1MB per API call which API ?
Thanks in advance -- Yonatan
On Apr 2, 7:38 pm, Movesax move...@gmail.com wrote:
thanks very much, you've both cleared things up for me.
--
You received this message because you are subscribed to the Google Groups
Google App Engine group.
To post to this group, send email to google-appengine@googlegroups.com.
To unsubscribe from this group, send email to
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en.