org.ckkloverdos.source
Interface ISource

All Known Implementing Classes:
FileSource, InputStreamSource, RcSource, SourceSkeleton, StringSource

public interface ISource

Generic representation of binary or text source. This for example could be java source code or the bytes of a jar file.

Author:
Christos KK Loverdos

Method Summary
 java.lang.String getDescription()
          Return the description of this source.
 java.io.InputStream getInputStream()
          Get an input stream for this source.
 java.lang.String getName()
          Return the name of this source.
 java.io.Reader getReader()
          Get a reader for the contents of this source.
 java.io.Reader getReader(java.lang.String encoding)
          Get a reader for the contents of this source.
 java.lang.String getString()
          Get a string from the contents of this source.
 java.lang.String getString(java.lang.String encoding)
          Get a string from the contents of this source.
 SourceType getType()
          Return the type of this source.
 boolean isText()
          Return true if the type of this source is text.
 boolean isValid()
          Return true iff any of the getInputStream(), getString(), getReader() methods will return a non-null object.
 

Method Detail

getName

java.lang.String getName()
Return the name of this source.


getType

SourceType getType()
Return the type of this source.


getDescription

java.lang.String getDescription()
Return the description of this source.


isValid

boolean isValid()
Return true iff any of the getInputStream(), getString(), getReader() methods will return a non-null object.


isText

boolean isText()
Return true if the type of this source is text.

Returns:
true iff getType().isText() returns true.

getInputStream

java.io.InputStream getInputStream()
                                   throws java.io.IOException
Get an input stream for this source.

Throws:
java.io.IOException

getString

java.lang.String getString(java.lang.String encoding)
                           throws java.io.IOException
Get a string from the contents of this source. The contents are interpeted using the provided encoding.

Parameters:
encoding -
Throws:
java.io.IOException

getString

java.lang.String getString()
                           throws java.io.IOException
Get a string from the contents of this source. The contents are interpeted using the default StringUtil.UTF8 encoding.

Throws:
java.io.IOException

getReader

java.io.Reader getReader(java.lang.String encoding)
                         throws java.io.IOException
Get a reader for the contents of this source. The contents are interpeted using the provided encoding.

Parameters:
encoding -
Throws:
java.io.IOException

getReader

java.io.Reader getReader()
                         throws java.io.IOException
Get a reader for the contents of this source. The contents are interpeted using the default StringUtil.UTF8 encoding.

Throws:
java.io.IOException


Copyright © 1999-2007 Christos KK Loverdos. All Rights Reserved.