Hi,

I am using experimental version of blob store API, to upload the file
retrieved as byte[] through a web service.

Following is the code I am using to upload the byte[] to blob store.

public BlobKey writeFileToBlobStore(String mimeType,byte[]
fileContent) {
     // Get a file service
     FileService fileService = FileServiceFactory.getFileService();
     AppEngineFile file = null;
      try {
        file = fileService.createNewBlobFile(mimeType);
        boolean lock = true;
        FileWriteChannel writeChannel = null;
        if(fileContent == null){
                 LOGGER.log(Level.INFO,"File Content is null...");
        } else {
                 writeChannel = fileService.openWriteChannel(file, lock);
                 writeChannel.write(ByteBuffer.wrap(fileContent));
                 writeChannel.closeFinally();
        }
       } catch (IOException e) {
        LOGGER.log(Level.SEVERE,e.getMessage(),e);
       }
        return fileService.getBlobKey(file);
       }

Using the code above the file gets uploaded successfully without any
exception to blobstore.
But strangely the size of file is lesser that the one which was
actually sent across through web service. And hence it gives error
while opening the file.
I have experienced this thing while uploading the ms office files i.e.
word doc and excel file.
If I try uploading some text file with larger text then the text file
gets displayed,but the content at the end is truncated.

The size of files I tried uploading were upto 450 kb (i.e. less then
32 MB  restriction given by blob store API).

Kindly help me out in the same and let me know if anything is missing
out in the code, or it is some restriction of the experimental version
of the API?

I am in need of getting this work very urgently, so any help would be
highly appreciated.

Thanks in advance,
Nirzari

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to google-appengine-java@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to