com.google.appengine.api.files.dev
Class GSFile

java.lang.Object
  extended by com.google.appengine.api.files.dev.FileMetadata
      extended by 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
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
 
Constructor Summary
GSFile(java.lang.String readName, java.lang.String appendName, ContentType contentType, boolean finalized, LocalFileService localFileService)
           
 
Method Summary
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.
protected  java.io.InputStream getInputStream()
           
protected  java.io.OutputStream getOutputStream()
           
protected static FileMetadata newFinalizedInstance(LocalFileService localFileService, Clock clock, ParsedFileName parsedName)
           
 
Methods inherited from class com.google.appengine.api.files.dev.FileMetadata
append, checkParameters, copy, getAppendName, getContentType, getLockState, getOpenState, isFinalized, isOpenInDifferentSession, lock, newReadableInstance, read, setFinalized, 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
Constructor Detail

GSFile

public GSFile(java.lang.String readName,
              java.lang.String appendName,
              ContentType contentType,
              boolean finalized,
              LocalFileService localFileService)
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)

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