|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jcrom.JcrDataProviderImpl
public class JcrDataProviderImpl
A simple implementation of the JcrDataProvider interface. Developers can implement their own data provider if advanced or custom functionality is needed.
Thanks to Robin Wyles for adding content length.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface org.jcrom.JcrDataProvider |
|---|
JcrDataProvider.TYPE |
| Field Summary | |
|---|---|
protected byte[] |
bytes
|
protected long |
contentLength
|
protected java.io.File |
file
|
protected java.io.InputStream |
inputStream
|
protected JcrDataProvider.TYPE |
type
|
| Constructor Summary | |
|---|---|
JcrDataProviderImpl(JcrDataProvider.TYPE type,
byte[] bytes)
|
|
JcrDataProviderImpl(JcrDataProvider.TYPE type,
java.io.File file)
|
|
JcrDataProviderImpl(JcrDataProvider.TYPE type,
java.io.InputStream inputStream)
|
|
JcrDataProviderImpl(JcrDataProvider.TYPE type,
java.io.InputStream inputStream,
long length)
|
|
| Method Summary | |
|---|---|
byte[] |
getBytes()
Return a byte array. |
long |
getContentLength()
Returns the length of the byte array / file / input stream |
java.io.File |
getFile()
Return a file. |
java.io.InputStream |
getInputStream()
Return an input stream. |
JcrDataProvider.TYPE |
getType()
Get the type of content this provider offers. |
protected static void |
write(byte[] bytes,
java.io.File destination)
|
protected static void |
write(java.io.File source,
java.io.File destination)
|
protected static void |
write(java.io.InputStream in,
java.io.File destination)
|
void |
writeToFile(java.io.File destination)
Write the content out to the File supplied. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final JcrDataProvider.TYPE type
protected final byte[] bytes
protected final java.io.File file
protected final java.io.InputStream inputStream
protected final long contentLength
| Constructor Detail |
|---|
public JcrDataProviderImpl(JcrDataProvider.TYPE type,
byte[] bytes)
public JcrDataProviderImpl(JcrDataProvider.TYPE type,
java.io.File file)
public JcrDataProviderImpl(JcrDataProvider.TYPE type,
java.io.InputStream inputStream)
public JcrDataProviderImpl(JcrDataProvider.TYPE type,
java.io.InputStream inputStream,
long length)
| Method Detail |
|---|
public byte[] getBytes()
JcrDataProvider
getBytes in interface JcrDataProviderpublic java.io.File getFile()
JcrDataProvider
getFile in interface JcrDataProviderpublic java.io.InputStream getInputStream()
JcrDataProvider
getInputStream in interface JcrDataProviderpublic JcrDataProvider.TYPE getType()
JcrDataProvider
getType in interface JcrDataProvider
public void writeToFile(java.io.File destination)
throws java.io.IOException
JcrDataProvider
writeToFile in interface JcrDataProviderdestination - the file in question
java.io.IOException
protected static void write(java.io.InputStream in,
java.io.File destination)
throws java.io.IOException
java.io.IOException
protected static void write(byte[] bytes,
java.io.File destination)
throws java.io.IOException
java.io.IOException
protected static void write(java.io.File source,
java.io.File destination)
throws java.io.IOException
java.io.IOExceptionpublic long getContentLength()
JcrDataProvider
getContentLength in interface JcrDataProvider
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||