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.

GSFile

com.google.appengine.api.files.dev

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

      • FILE_SYSTEM

        public static final java.lang.String FILE_SYSTEM
      • CREATION_HANDLE_PREFIX

        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 com.google.appengine.api.blobstore.BlobInfo getBlobInfo()
        Specified by:
        getBlobInfo in class FileMetadata
        Returns:
        the BlobInfo of the file. File must have been finalized.
      • getOutputStream

        protected java.io.OutputStream getOutputStream()
                                                throws java.io.IOException
        Specified by:
        getOutputStream in class FileMetadata
        Throws:
        java.io.IOException
      • getInputStream

        protected java.io.InputStream getInputStream()
                                              throws java.io.IOException
        Specified by:
        getInputStream in class FileMetadata
        Throws:
        java.io.IOException