Class BoxResource
- java.lang.Object
-
- org.craftercms.commons.spring.resources.BoxResource
-
- All Implemented Interfaces:
RangeAwareResource,org.springframework.core.io.InputStreamSource,org.springframework.core.io.Resource
public class BoxResource extends Object implements RangeAwareResource
Implementation ofResourcefor Box files.- Author:
- avasquez
-
-
Constructor Summary
Constructors Constructor Description BoxResource(com.box.sdk.BoxAPIConnection apiConnection, String fileId)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longcontentLength()org.springframework.core.io.ResourcecreateRelative(String relativePath)booleanexists()StringgetDescription()FilegetFile()StringgetFilename()InputStreamgetInputStream()InputStreamgetInputStream(long start, long end)Returns a range of bytes from the resource's content.URIgetURI()URLgetURL()booleanisOpen()booleanisReadable()longlastModified()StringtoString()
-
-
-
Constructor Detail
-
BoxResource
public BoxResource(com.box.sdk.BoxAPIConnection apiConnection, String fileId)
-
-
Method Detail
-
exists
public boolean exists()
- Specified by:
existsin interfaceorg.springframework.core.io.Resource
-
isReadable
public boolean isReadable()
- Specified by:
isReadablein interfaceorg.springframework.core.io.Resource
-
isOpen
public boolean isOpen()
- Specified by:
isOpenin interfaceorg.springframework.core.io.Resource
-
getURL
public URL getURL() throws IOException
- Specified by:
getURLin interfaceorg.springframework.core.io.Resource- Throws:
IOException
-
getURI
public URI getURI() throws IOException
- Specified by:
getURIin interfaceorg.springframework.core.io.Resource- Throws:
IOException
-
getFile
public File getFile() throws IOException
- Specified by:
getFilein interfaceorg.springframework.core.io.Resource- Throws:
IOException
-
contentLength
public long contentLength() throws IOException- Specified by:
contentLengthin interfaceorg.springframework.core.io.Resource- Throws:
IOException
-
lastModified
public long lastModified() throws IOException- Specified by:
lastModifiedin interfaceorg.springframework.core.io.Resource- Throws:
IOException
-
createRelative
public org.springframework.core.io.Resource createRelative(String relativePath) throws IOException
- Specified by:
createRelativein interfaceorg.springframework.core.io.Resource- Throws:
IOException
-
getFilename
public String getFilename()
- Specified by:
getFilenamein interfaceorg.springframework.core.io.Resource
-
getDescription
public String getDescription()
- Specified by:
getDescriptionin interfaceorg.springframework.core.io.Resource
-
getInputStream
public InputStream getInputStream() throws IOException
- Specified by:
getInputStreamin interfaceorg.springframework.core.io.InputStreamSource- Throws:
IOException
-
getInputStream
public InputStream getInputStream(long start, long end) throws IOException
Description copied from interface:RangeAwareResourceReturns a range of bytes from the resource's content.- Specified by:
getInputStreamin interfaceRangeAwareResource- Parameters:
start- the start of the rangeend- the end of the range- Returns:
- an input stream with the content range
- Throws:
IOException- if an IO error occurs
-
-