Spring Data Document

org.springframework.data.mongodb.gridfs
Class GridFsResource

java.lang.Object
  extended by org.springframework.core.io.AbstractResource
      extended by org.springframework.core.io.InputStreamResource
          extended by org.springframework.data.mongodb.gridfs.GridFsResource
All Implemented Interfaces:
InputStreamSource, Resource

public class GridFsResource
extends InputStreamResource

GridFSDBFile based Resource implementation.

Author:
Oliver Gierke

Constructor Summary
GridFsResource(GridFSDBFile file)
          Creates a new GridFsResource from the given GridFSDBFile.
 
Method Summary
 long contentLength()
           
 String getContentType()
          Returns the Resource's content type.
 String getFilename()
           
 Object getId()
          Returns the Resource's id.
 long lastModified()
           
 
Methods inherited from class org.springframework.core.io.InputStreamResource
equals, exists, getDescription, getInputStream, hashCode, isOpen
 
Methods inherited from class org.springframework.core.io.AbstractResource
createRelative, getFile, getFileForLastModifiedCheck, getURI, getURL, isReadable, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GridFsResource

public GridFsResource(GridFSDBFile file)
Creates a new GridFsResource from the given GridFSDBFile.

Parameters:
file - must not be null.
Method Detail

contentLength

public long contentLength()
                   throws IOException
Specified by:
contentLength in interface Resource
Overrides:
contentLength in class AbstractResource
Throws:
IOException

getFilename

public String getFilename()
                   throws IllegalStateException
Specified by:
getFilename in interface Resource
Overrides:
getFilename in class AbstractResource
Throws:
IllegalStateException

lastModified

public long lastModified()
                  throws IOException
Specified by:
lastModified in interface Resource
Overrides:
lastModified in class AbstractResource
Throws:
IOException

getId

public Object getId()
Returns the Resource's id.

Returns:

getContentType

public String getContentType()
Returns the Resource's content type.

Returns:

Spring Data Document

Copyright © 2012. All Rights Reserved.