Constructor and Description |
---|
SpringResource(org.springframework.core.io.Resource resource) |
Modifier and Type | Method and Description |
---|---|
void |
append(Action<OutputStream> arg0)
Opens up an
InputStream to append (write at the end of the
existing stream) to the resource. |
long |
getLastModified()
Gets the last modified timestamp value (measured in milliseconds since
the epoch (00:00:00 GMT, January 1, 1970)) of the resource, if available.
|
String |
getName()
Gets the name of the resource, typically a filename or other identifying
string
|
String |
getQualifiedPath()
Gets the qualified path of the resource, which typically includes slash
or backslash separated nodes in a hierarical tree structure.
|
org.springframework.core.io.Resource |
getResource()
Gets the underlying spring
Resource
object. |
long |
getSize()
Gets the size (in number of bytes) of this resource's data.
|
boolean |
isExists()
Determines if the resource referenced by this object exists or not.
|
boolean |
isReadOnly()
Determines if the file is read only, or if writes are also possible.
|
InputStream |
read()
Opens up an
InputStream to read from the resource. |
void |
read(Action<InputStream> action)
Opens up an
InputStream to read from the resource, and allows a
callback to perform writing actions on it. |
<E> E |
read(Func<InputStream,E> func)
Opens up an
InputStream to read from the resource, and allows a
callback function to perform writing actions on it and return the
function's result. |
void |
write(Action<OutputStream> arg0)
Opens up an
OutputStream to write to the resource, and allows a
callback to perform writing actions on it. |
public SpringResource(org.springframework.core.io.Resource resource)
public void append(Action<OutputStream> arg0) throws ResourceException
Resource
InputStream
to append (write at the end of the
existing stream) to the resource.append
in interface Resource
arg0
- a callback which should define what to append to the resource.ResourceException
- if an error occurs while appendingpublic long getLastModified()
Resource
getLastModified
in interface Resource
public String getName()
Resource
public String getQualifiedPath()
Resource
getQualifiedPath
in interface Resource
public long getSize()
Resource
public boolean isExists()
Resource
public boolean isReadOnly()
Resource
isReadOnly
in interface Resource
public InputStream read() throws ResourceException
Resource
InputStream
to read from the resource. Consumers of
this method are expected to invoke the InputStream.close()
method
manually.
If possible, the other read(...) methods are preferred over this one,
since they guarantee proper closing of the resource's handles.read
in interface Resource
ResourceException
public void read(Action<InputStream> action) throws ResourceException
Resource
InputStream
to read from the resource, and allows a
callback to perform writing actions on it.read
in interface Resource
ResourceException
- if an error occurs while readingpublic <E> E read(Func<InputStream,E> func) throws ResourceException
Resource
InputStream
to read from the resource, and allows a
callback function to perform writing actions on it and return the
function's result.read
in interface Resource
ResourceException
- if an error occurs while readingpublic void write(Action<OutputStream> arg0) throws ResourceException
Resource
OutputStream
to write to the resource, and allows a
callback to perform writing actions on it.write
in interface Resource
arg0
- a callback which should define what to write to the resource.ResourceException
- if an error occurs while writingpublic org.springframework.core.io.Resource getResource()
Resource
object.Copyright © 2007–2014 The Apache Software Foundation. All rights reserved.