## com.google.appengine.api.files.dev
Class FileMetadata

    java.lang.Object
      com.google.appengine.api.files.dev.FileMetadata

Direct Known Subclasses:
  BlobstoreFile

    public abstract class FileMetadata

extends java.lang.Object

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 ContentType` `contentType`
`protected boolean` `finalized`

Constructor Summary
`FileMetadata(ContentType contentType)`

Method Summary
`abstract void` `append(AppendRequest request)` Handle an append request
`ContentType` `getContentType()`
`FileMetadata.LockState` `getLockState(Session session)`
`FileMetadata.OpenState` `getOpenState(Session session)`
`boolean` `isFinalized()`
`boolean` `isOpenInDifferentSession(Session session)`
`static boolean` `isSpecialReadOnlyName(ParsedFileName parsedName)`
`void` `lock(Session session)`
`static FileMetadata` `newInstance(LocalFileService localFileService, ParsedFileName parsedName, OpenMode openMode, ContentType contentType, java.util.Map<java.lang.String,java.lang.String> parameters)` Creates a new instance of `FileMetadata`.
`abstract 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

### contentType

    protected ContentType contentType

### finalized

    protected boolean finalized

Constructor Detail

### FileMetadata

    public FileMetadata(ContentType contentType)

Method Detail

### setFinalized

    public void setFinalized()

### isFinalized

    public boolean isFinalized()

### getContentType

    public ContentType getContentType()

### lock

    public void lock(Session session)

### getLockState

    public FileMetadata.LockState getLockState(Session session)

### setState

    public void setState(FileMetadata.OpenState state,
                         Session session)

### getOpenState

    public FileMetadata.OpenState getOpenState(Session session)

### isOpenInDifferentSession

    public boolean isOpenInDifferentSession(Session session)

### read

    public abstract ByteString read(ReadRequest request)

  Handle a Read request

  Parameters:
    `request` - the request
  Returns:
    A `ByteString` containing the read bytes

### append

    public abstract void append(AppendRequest request)

  Handle an append request

  Parameters:
    `request` - the request

### isSpecialReadOnlyName

    public static boolean isSpecialReadOnlyName(ParsedFileName parsedName)

### newInstance

    public static FileMetadata newInstance(LocalFileService localFileService,
                                           ParsedFileName parsedName,
                                           OpenMode openMode,
                                           ContentType contentType,
                                           java.util.Map<java.lang.String,java.lang.String> parameters)

  Creates a new instance of `FileMetadata`. This method is called in response to two types of requests: A Create request or the first Read request of a special read-only file.