Notice: Over the next few months, we're reorganizing the App Engine documentation site to make it easier to find content and better align with the rest of Google Cloud products. The same content will be available, but the navigation will now match the rest of the Cloud products. If you have feedback or questions as you navigate the site, click Send Feedback.


Class GSFile

  • public class GSFile
    extends FileMetadata
    A Google Cloud Storage object represented by a local file in blobstore. Appendable versions of GSFiles have paths of the form /gs/writable:random?name=bucket%2fkey. Unfinalized bytes are stored in memory. Finalizing an object copies the bytes to a local blobstore file, which is accessible at /gs/bucket/key.
    • Field Detail


        public static final java.lang.String FILE_SYSTEM

        public static final java.lang.String CREATION_HANDLE_PREFIX
        See Also:
        Constant Field Values
    • Method Detail

      • buildWritablePath

        public static java.lang.String buildWritablePath(java.lang.String randomString,
                                                         java.lang.String fileName)
      • create

        public static FileMetadata create(LocalFileService localFileService,
                                          Clock clock,
                                          java.lang.String fileName,
                                          java.lang.String randomString,
                                          ContentType contentType,
                                          java.util.Map<java.lang.String,java.lang.String> parameters)
        Creates a new instance. There are two cases: 1) A create request 2) A read request for a special read-only file.
      • getBlobInfo

        public getBlobInfo()
        Specified by:
        getBlobInfo in class FileMetadata
        the BlobInfo of the file. File must have been finalized.
      • getOutputStream

        protected getOutputStream()
        Specified by:
        getOutputStream in class FileMetadata
      • getInputStream

        protected getInputStream()
        Specified by:
        getInputStream in class FileMetadata