|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface FileService
This is the interface for interacting with the Google App Engine File
Service. A FileService
instance is obtained via
FileServiceFactory.getFileService()
.
Method Summary | |
---|---|
AppEngineFile |
createNewBlobFile(java.lang.String mimeType)
Creates a new empty file in the BlobStore of the specified mime-type and returns an AppEngineFile representing the file. |
AppEngineFile |
createNewBlobFile(java.lang.String mimeType,
java.lang.String blobInfoUploadedFileName)
Creates a new empty file in the BlobStore of the specified mime-type and returns an AppEngineFile representing the file. |
AppEngineFile |
getBlobFile(BlobKey blobKey)
Given a BlobKey returns the corresponding AppEngineFile . |
BlobKey |
getBlobKey(AppEngineFile file)
Given a BLOBSTORE file that has been finalized, returns the BlobKey for
the corresponding blob. |
FileReadChannel |
openReadChannel(AppEngineFile file,
boolean lock)
Given an AppEngineFile , returns a FileReadChannel that may
be used for reading bytes from the file. |
FileWriteChannel |
openWriteChannel(AppEngineFile file,
boolean lock)
Given an AppEngineFile , returns a FileWriteChannel that may
be used for appending bytes to the file. |
Method Detail |
---|
AppEngineFile createNewBlobFile(java.lang.String mimeType) throws java.io.IOException
AppEngineFile
representing the file. The returned
instance will have a file system
of
BLOBSTORE
.
mimeType
- the mime-type of the file to be created. This parameter may
be used to inform the BlobStore of the mime-type for the file. The
mime-type will be returned by the BlobStore in an HTTP response if
the file is requested directly from the BlobStore using the
blob-key.
AppEngineFile
representing the newly created file.
java.io.IOException
- If there is any problem communicating with the backend
systemAppEngineFile createNewBlobFile(java.lang.String mimeType, java.lang.String blobInfoUploadedFileName) throws java.io.IOException
AppEngineFile
representing the file. The returned
instance will have a file system
of
BLOBSTORE
.
mimeType
- the mime-type of the file to be created. This parameter may
be used to inform the BlobStore of the mime-type for the file. The
mime-type will be returned by the BlobStore in an HTTP response if
the file is requested directly from the BlobStore using the
blob-key.blobInfoUploadedFileName
- BlobStore will store this name in the
BlobInfo's fileName field. This string will not be
the name
of the returned
AppEngineFile
. It will be returned by the BlobStore in an HTTP
response if the file is requested directly from the BlobStore using
the blob-key.
AppEngineFile
representing the newly created file.
java.io.IOException
- If there is any problem communicating with the backend
systemFileWriteChannel openWriteChannel(AppEngineFile file, boolean lock) throws java.io.FileNotFoundException, FinalizationException, LockException, java.io.IOException
AppEngineFile
, returns a FileWriteChannel
that may
be used for appending bytes to the file.
file
- the file to which to append bytes. The file must exist and it
must not yet have been finalized.lock
- should the file be locked for exclusive access?
java.io.FileNotFoundException
- if the file does not exist in the backend
repository. The file may have been deleted by another request, or
the file may have been lost due to system failure or a scheduled
relocation. Each backend repository offers different guarantees
regarding when this is possible.
FinalizationException
- if the file has already been finalized. The
file may have been finalized by another request.
LockException
- if the file is locked in a different App Engine
request, or if lock = true
and the file is opened in a
different App Engine request
java.io.IOException
- if any other unexpected problem occursFileReadChannel openReadChannel(AppEngineFile file, boolean lock) throws java.io.FileNotFoundException, LockException, java.io.IOException
AppEngineFile
, returns a FileReadChannel
that may
be used for reading bytes from the file.
file
- The file from which to read bytes. The file must exist and it
must have been finalized.lock
- Should the file be locked for exclusive access?
java.io.FileNotFoundException
- if the file does not exist in the backend
repository. The file may have been deleted by another request, or
the file may have been lost due to system failure or a scheduled
relocation. Each backend repository offers different guarantees
regarding when this is possible.
FinalizationException
- if the file has not yet been finalized
LockException
- if the file is locked in a different App Engine
request, or if lock = true
and the file is opened in a
different App Engine request
java.io.IOException
- if any other problem occurs contacting the backend
systemBlobKey getBlobKey(AppEngineFile file)
BLOBSTORE
file that has been finalized, returns the BlobKey
for
the corresponding blob.
file
- A BLOBSTORE
file that has been finalized
BlobKey
, or null
if none can be
found. This can occur if the file has not been finalized, or if it
does not exist.
java.lang.IllegalArgumentException
- if file
is not a BLOBSTORE
file.AppEngineFile getBlobFile(BlobKey blobKey) throws java.io.FileNotFoundException
BlobKey
returns the corresponding AppEngineFile
.
The file has been finalized.
blobKey
- A blobkey
java.io.FileNotFoundException
- if there is no blob with the given blob key.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |