문제

This guide on the Python library says cloudstorage.stat() returns

... last-modified time, header-length, content type for the specified file.

The Java guide however, seems to have no counterpart. At least, I cannot find it in GcsFileMetadata.

Is it possible to get this information using the Java library?

도움이 되었습니까?

해결책

It seems the Java library doesn't have this feature (yet).

You can set this info manually, though:

GSFileOptionsBuilder optionsBuilder = new GSFileOptionsBuilder()
  .setBucket("my_bucket") 
  .setKey("my_object")
  .setAcl("public-read")
  .setMimeType("text/html") //etc etc
  .setUserMetadata("date-created", "01/09/2011", "owner", "Jon");

And retrieve this piece of metadata with

GcsFileMetadata.getOptions().getUserMetadata().get("date-created")
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top