com.google.appengine.api.files.dev

## Class GSFile

- java.lang.Object
- - com.google.appengine.api.files.dev.FileMetadata
  - - com.google.appengine.api.files.dev.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.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class com.google.appengine.api.files.dev.FileMetadata

      `FileMetadata.LockState, FileMetadata.OpenState`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String` | `CREATION_HANDLE_PREFIX`
    `static java.lang.String` | `FILE_SYSTEM`

    - ### Fields inherited from class com.google.appengine.api.files.dev.FileMetadata

      `appendName, contentType, currentSequenceKey, finalized, readName, tempBytes, tempBytesSizeWhenFinalized`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static java.lang.String` | `buildWritablePath(java.lang.String randomString, java.lang.String fileName)`
    `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.
    `com.google.appengine.api.blobstore.BlobInfo` | `getBlobInfo()`
    `protected java.io.InputStream` | `getInputStream()`
    `protected java.io.OutputStream` | `getOutputStream()`
    `protected static FileMetadata` | `newFinalizedInstance(LocalFileService localFileService, Clock clock, ParsedFileName parsedName)`
    `void` | `setFinalized()`

    - ### Methods inherited from class com.google.appengine.api.files.dev.FileMetadata

      `append, checkParameters, copy, getAppendName, getContentType, getLockState, getOpenState, getTempBytesSize, isFinalized, isOpenInDifferentSession, lock, newReadableInstance, read, saveBlobInfo, setState`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### 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.

    - #### newFinalizedInstance

          protected static FileMetadata newFinalizedInstance(LocalFileService localFileService,
                                                             Clock clock,
                                                             ParsedFileName parsedName)

    - #### 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.

    - #### setFinalized

          public void setFinalized()

      Overrides:
        `setFinalized` in class `FileMetadata`

    - #### 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`