org.jcrom
Interface JcrDataProvider

All Known Implementing Classes:
JcrDataProviderImpl

public interface JcrDataProvider

An interface for providing access to file content within a JcrFile instance.

Thanks to Robin Wyles for adding content length.

Author:
Olafur Gauti Gudmundsson

Nested Class Summary
static class JcrDataProvider.TYPE
           
 
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.
 void writeToFile(java.io.File file)
          Write the content out to the File supplied.
 

Method Detail

getType

JcrDataProvider.TYPE getType()
Get the type of content this provider offers.

Returns:
the type of content this provider offers

getFile

java.io.File getFile()
Return a file.

Returns:
file, or null if type is not JcrDataProvider.TYPE.FILE

getBytes

byte[] getBytes()
Return a byte array.

Returns:
byte array, or null if type is not JcrDataProvider.TYPE.BYTES

getInputStream

java.io.InputStream getInputStream()
Return an input stream.

Returns:
input stream, or null if type is not JcrDataProvider.TYPE.STREAM

writeToFile

void writeToFile(java.io.File file)
                 throws java.io.IOException
Write the content out to the File supplied.

Parameters:
file - the file in question
Throws:
java.io.IOException

getContentLength

long getContentLength()
Returns the length of the byte array / file / input stream

Returns:


Copyright © 2009. All Rights Reserved.