org.apache.solr.util
Class ContentStreamBase.URLStream

java.lang.Object
  extended by org.apache.solr.util.ContentStreamBase
      extended by org.apache.solr.util.ContentStreamBase.URLStream
All Implemented Interfaces:
ContentStream
Enclosing class:
ContentStreamBase

public static class ContentStreamBase.URLStream
extends ContentStreamBase

Construct a ContentStream from a URL This uses a URLConnection to get the content stream

See Also:
URLConnection

Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.solr.util.ContentStreamBase
ContentStreamBase.FileStream, ContentStreamBase.StringStream, ContentStreamBase.URLStream
 
Field Summary
 
Fields inherited from class org.apache.solr.util.ContentStreamBase
contentType, DEFAULT_CHARSET, name, size, sourceInfo
 
Constructor Summary
ContentStreamBase.URLStream(java.net.URL url)
           
 
Method Summary
 java.io.InputStream getStream()
          Get an open stream.
 
Methods inherited from class org.apache.solr.util.ContentStreamBase
getCharsetFromContentType, getContentType, getName, getReader, getSize, getSourceInfo, setContentType, setName, setSize, setSourceInfo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContentStreamBase.URLStream

public ContentStreamBase.URLStream(java.net.URL url)
                            throws java.io.IOException
Throws:
java.io.IOException
Method Detail

getStream

public java.io.InputStream getStream()
                              throws java.io.IOException
Description copied from interface: ContentStream
Get an open stream. You are responsible for closing it. Consider using something like:
   InputStream stream = stream.getStream();
   try {
     // use the stream...
   }
   finally {
     IOUtils.closeQuietly(reader);
   }
  
Only the first call to getStream() or getReader() is gaurenteed to work. The runtime behavior for aditional calls is undefined.

Throws:
java.io.IOException


Copyright © 2006 - 2008 The Apache Software Foundation