2017-02-23 36 views
0

我試圖從Google Storage下載文件。 如果我訪問Google Storage頁面,我可以正確下載該文件。嘗試在Google Storage中下載文件返回json

但是,如果我嘗試使用API​​下載,它返回一個JSON對象:

{ 
    "kind": "storage#object", 
    "id": "storage-key/file/id", 
    "selfLink": "link", 
    "name": "name.xlsx", 
    "bucket": "bucketName", 
    "generation": "35452344234", 
    "metageneration": "1", 
    "contentType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", 
    "timeCreated": "2017-02-23T12:35:04.258Z", 
    "updated": "2017-02-23T12:35:04.258Z", 
    "storageClass": "STANDARD", 
    "timeStorageClassUpdated": "2017-02-23T12:35:04.258Z", 
    "size": "4679", 
    "md5Hash": "k3A546723454afhjgrfKuZw==", 
    "mediaLink": "medialink", 
    "crc32c": "U2ajDQ==", 
    "etag": "DMiAt62dbtICAAE=" 
} 

我basicly使用:

import com.google.api.services.storage.Storage; 
storage.objects().get(bucketName, fileName).executeAsInputStream(); 

而昨天它的工作: 你有任何意識到爲什麼它返回一個JSON?

回答

相關問題