Pregunta

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?

¿Fue útil?

Solución

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")
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top