org.mule.config.spring.util
Class CachedResource

java.lang.Object
  extended by org.springframework.core.io.AbstractResource
      extended by org.mule.config.spring.util.CachedResource
All Implemented Interfaces:
org.springframework.core.io.InputStreamSource, org.springframework.core.io.Resource

public class CachedResource
extends org.springframework.core.io.AbstractResource

Spring 2.x is picky about open/closed input streams, as it requires a closed stream (fully read resource) to enable automatic validation detection (DTD or XSD). Otherwise, a caller has to specify the mode explicitly.

Code relying on Spring 1.2.x behavior may now break with BeanDefinitionStoreException. This class is called in to remedy this and should be used instead of, e.g. InputStreamResource.

The resource is fully stored in memory.


Constructor Summary
CachedResource(byte[] source)
           
CachedResource(byte[] source, String description)
           
CachedResource(Reader reader, String encoding)
           
CachedResource(String source, String encoding)
           
 
Method Summary
 String getDescription()
           
 InputStream getInputStream()
           
 
Methods inherited from class org.springframework.core.io.AbstractResource
createRelative, equals, exists, getFile, getFileForLastModifiedCheck, getFilename, getURI, getURL, hashCode, isOpen, isReadable, lastModified, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CachedResource

public CachedResource(byte[] source)

CachedResource

public CachedResource(String source,
                      String encoding)
               throws UnsupportedEncodingException
Throws:
UnsupportedEncodingException

CachedResource

public CachedResource(byte[] source,
                      String description)

CachedResource

public CachedResource(Reader reader,
                      String encoding)
               throws IOException
Throws:
IOException
Method Detail

getDescription

public String getDescription()

getInputStream

public InputStream getInputStream()
                           throws IOException
Throws:
IOException


Copyright © 2003-2009 MuleSource, Inc.. All Rights Reserved.