Class FileHandle
- java.lang.Object
-
- com.composum.sling.clientlibs.handle.FileHandle
-
- Direct Known Subclasses:
ImageHandle
public class FileHandle extends Object
-
-
Field Summary
Fields Modifier and Type Field Description protected ResourceHandlecontentstatic Map<String,Object>CRUD_CONTENT_PROPSstatic Map<String,Object>CRUD_FILE_PROPSprotected Stringencodingprotected Stringextensionprotected CalendarlastModifiedprotected StringmimeTypeprotected Stringnameprotected ResourceHandleresource
-
Constructor Summary
Constructors Constructor Description FileHandle(@Nullable org.apache.sling.api.resource.Resource resource)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ResourceHandlegetContent()Handle to the content node of the file; not null.StringgetEncoding()StringgetExtension()CalendargetLastModified()StringgetMimeType()StringgetName()StringgetPath()ResourceHandlegetResource()Handle to the main node of the file; not null.LonggetSize()InputStreamgetStream()booleanisValid()protected ResourceHandleretrieveContent()protected voidretrieveNameAndExt()voidstoreContent(InputStream stream)StringtoString()voidupdateLastModified()Updates the last modified value, if the mix:lastModified is present.
-
-
-
Field Detail
-
resource
protected final ResourceHandle resource
-
content
protected final ResourceHandle content
-
name
protected transient String name
-
extension
protected transient String extension
-
mimeType
protected transient String mimeType
-
encoding
protected transient String encoding
-
lastModified
protected transient Calendar lastModified
-
-
Method Detail
-
getContent
public ResourceHandle getContent()
Handle to the content node of the file; not null.
-
getResource
public ResourceHandle getResource()
Handle to the main node of the file; not null.
-
isValid
public boolean isValid()
-
getPath
public String getPath()
-
getName
public String getName()
-
getExtension
public String getExtension()
-
getMimeType
public String getMimeType()
-
getEncoding
public String getEncoding()
-
getLastModified
public Calendar getLastModified()
-
getSize
public Long getSize()
-
getStream
public InputStream getStream()
-
storeContent
public void storeContent(InputStream stream)
-
updateLastModified
public void updateLastModified()
Updates the last modified value, if the mix:lastModified is present.
-
retrieveContent
protected ResourceHandle retrieveContent()
-
retrieveNameAndExt
protected void retrieveNameAndExt()
-
-