org.apache.solr.util
Class ContentStreamBase

java.lang.Object
  extended by org.apache.solr.util.ContentStreamBase
All Implemented Interfaces:
ContentStream
Direct Known Subclasses:
ContentStreamBase.FileStream, ContentStreamBase.StringStream, ContentStreamBase.URLStream

public abstract class ContentStreamBase
extends java.lang.Object
implements ContentStream

Three concrete implementations for ContentStream - one for File/URL/String

Since:
solr 1.2
Version:
$Id$
Author:
ryan

Nested Class Summary
static class ContentStreamBase.FileStream
          Construct a ContentStream from a File
static class ContentStreamBase.StringStream
          Construct a ContentStream from a File
static class ContentStreamBase.URLStream
          Construct a ContentStream from a URL This uses a URLConnection to get the content stream
 
Field Summary
protected  java.lang.String contentType
           
static java.lang.String DEFAULT_CHARSET
           
protected  java.lang.String name
           
protected  java.lang.Long size
           
protected  java.lang.String sourceInfo
           
 
Constructor Summary
ContentStreamBase()
           
 
Method Summary
static java.lang.String getCharsetFromContentType(java.lang.String contentType)
           
 java.lang.String getContentType()
           
 java.lang.String getName()
           
 java.io.Reader getReader()
          Base reader implementation.
 java.lang.Long getSize()
           
 java.lang.String getSourceInfo()
           
 void setContentType(java.lang.String contentType)
           
 void setName(java.lang.String name)
           
 void setSize(java.lang.Long size)
           
 void setSourceInfo(java.lang.String sourceInfo)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.solr.util.ContentStream
getStream
 

Field Detail

DEFAULT_CHARSET

public static final java.lang.String DEFAULT_CHARSET
See Also:
Constant Field Values

name

protected java.lang.String name

sourceInfo

protected java.lang.String sourceInfo

contentType

protected java.lang.String contentType

size

protected java.lang.Long size
Constructor Detail

ContentStreamBase

public ContentStreamBase()
Method Detail

getCharsetFromContentType

public static java.lang.String getCharsetFromContentType(java.lang.String contentType)

getReader

public java.io.Reader getReader()
                         throws java.io.IOException
Base reader implementation. If the contentType declares a charset use it, otherwise use "utf-8".

Specified by:
getReader in interface ContentStream
Throws:
java.io.IOException

getContentType

public java.lang.String getContentType()
Specified by:
getContentType in interface ContentStream

setContentType

public void setContentType(java.lang.String contentType)

getName

public java.lang.String getName()
Specified by:
getName in interface ContentStream

setName

public void setName(java.lang.String name)

getSize

public java.lang.Long getSize()
Specified by:
getSize in interface ContentStream
Returns:
the stream size or null if not known

setSize

public void setSize(java.lang.Long size)

getSourceInfo

public java.lang.String getSourceInfo()
Specified by:
getSourceInfo in interface ContentStream

setSourceInfo

public void setSourceInfo(java.lang.String sourceInfo)


Copyright © 2006 - 2009 The Apache Software Foundation