|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.google.appengine.api.files.dev.FileMetadata
public abstract class FileMetadata
This class represents a single file stored by the local file service. This class is abstract. There are concrete subclasses corresponding to each of the concrete backend storage repositories.
Nested Class Summary | |
---|---|
static class |
FileMetadata.LockState
|
static class |
FileMetadata.OpenState
The state of a file in a particular session. |
Field Summary | |
---|---|
protected java.lang.String |
appendName
The name of the appendable version of this unfinalized file. |
protected ContentType |
contentType
|
protected java.lang.String |
currentSequenceKey
If this instance is for writing and it has not yet been finalized, then this variable stores the current sequence key |
protected boolean |
finalized
|
protected java.lang.String |
readName
The name of the readable version of this file once it is finalized. |
protected java.io.ByteArrayOutputStream |
tempBytes
If this instance is for writing and it has not yet been finalized, then this variable stores the current bytes. |
Constructor Summary | |
---|---|
FileMetadata(java.lang.String readName,
java.lang.String appendName,
ContentType contentType)
|
Method Summary | |
---|---|
void |
append(AppendRequest request)
Handle an append request |
protected static void |
checkParameters(java.util.Map<java.lang.String,java.lang.String> parameters,
java.lang.String... names)
|
protected static long |
copy(java.io.InputStream from,
java.io.OutputStream to,
long maxBytes)
Copies maxBytes bytes from the input stream to the output stream. |
java.lang.String |
getAppendName()
|
ContentType |
getContentType()
|
protected abstract java.io.InputStream |
getInputStream()
|
FileMetadata.LockState |
getLockState(Session session)
|
FileMetadata.OpenState |
getOpenState(Session session)
|
protected abstract java.io.OutputStream |
getOutputStream()
|
boolean |
isFinalized()
|
boolean |
isOpenInDifferentSession(Session session)
|
void |
lock(Session session)
|
static FileMetadata |
newReadableInstance(LocalFileService localFileService,
Clock clock,
ParsedFileName parsedName)
Returns a new instance of FileMetadata if possible. |
ByteString |
read(ReadRequest request)
Handle a Read request |
void |
setFinalized()
|
void |
setState(FileMetadata.OpenState state,
Session session)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected ContentType contentType
protected boolean finalized
protected final java.lang.String readName
protected final java.lang.String appendName
protected java.lang.String currentSequenceKey
protected final java.io.ByteArrayOutputStream tempBytes
Constructor Detail |
---|
public FileMetadata(java.lang.String readName, java.lang.String appendName, ContentType contentType)
Method Detail |
---|
public java.lang.String getAppendName()
public void setFinalized()
public boolean isFinalized()
public ContentType getContentType()
public void lock(Session session)
public FileMetadata.LockState getLockState(Session session)
public void setState(FileMetadata.OpenState state, Session session)
public FileMetadata.OpenState getOpenState(Session session)
public boolean isOpenInDifferentSession(Session session)
public ByteString read(ReadRequest request)
request
- the request
ByteString
containing the read bytespublic void append(AppendRequest request)
request
- the requestprotected abstract java.io.InputStream getInputStream() throws java.io.IOException
java.io.IOException
protected abstract java.io.OutputStream getOutputStream() throws java.io.IOException
java.io.IOException
protected static void checkParameters(java.util.Map<java.lang.String,java.lang.String> parameters, java.lang.String... names)
protected static long copy(java.io.InputStream from, java.io.OutputStream to, long maxBytes) throws java.io.IOException
maxBytes
bytes from the input stream to the output stream.
java.io.IOException
public static FileMetadata newReadableInstance(LocalFileService localFileService, Clock clock, ParsedFileName parsedName)
FileMetadata
if possible. This method is
called in response to an Open-for-Read request in the case that no
meta-data is found for the requested file in the in-memory cache. If it is
determined that the given file name corresponds to an existing, finalized
file, then an instance of FileMetadata
will be returned. Otherwise
null
will be returned.
FileMetadata
or null
if no
corresponding entity could be found in the datastore.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |