xmlgraphics-commons 2.3

org.apache.xmlgraphics.io
Class XmlSourceUtil

java.lang.Object
  extended by org.apache.xmlgraphics.io.XmlSourceUtil

public final class XmlSourceUtil
extends java.lang.Object

A utility class for handling Source objects, more specficially the streams that back the Source.


Method Summary
static void closeQuietly(javax.xml.transform.Source src)
          Closes the InputStreams or ImageInputStreams of Source objects.
static java.io.InputStream getInputStream(javax.xml.transform.Source src)
          Returns the InputStream that is backing the given Source object.
static boolean hasInputStream(javax.xml.transform.Source src)
          Indicates whether the Source object has an InputStream instance.
static boolean hasReader(javax.xml.transform.Source src)
          Indicates whether the Source object has a Reader instance.
static java.io.InputStream needInputStream(javax.xml.transform.Source src)
          Returns the InputStream of a Source object.
static void removeStreams(javax.xml.transform.Source src)
          Removes any references to InputStreams or Readers from the given Source to prohibit accidental/unwanted use by a component further downstream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInputStream

public static java.io.InputStream getInputStream(javax.xml.transform.Source src)
Returns the InputStream that is backing the given Source object.

Parameters:
src - is backed by an InputStream
Returns:
the input stream

needInputStream

public static java.io.InputStream needInputStream(javax.xml.transform.Source src)
Returns the InputStream of a Source object. This method throws an IllegalArgumentException if there's no InputStream instance available from the Source object.

Parameters:
src - the Source object
Returns:
the InputStream

hasReader

public static boolean hasReader(javax.xml.transform.Source src)
Indicates whether the Source object has a Reader instance.

Parameters:
src - the Source object
Returns:
true if an Reader is available

removeStreams

public static void removeStreams(javax.xml.transform.Source src)
Removes any references to InputStreams or Readers from the given Source to prohibit accidental/unwanted use by a component further downstream.

Parameters:
src - the Source object

closeQuietly

public static void closeQuietly(javax.xml.transform.Source src)
Closes the InputStreams or ImageInputStreams of Source objects. Any exception occurring while closing the stream is ignored.

Parameters:
src - the Source object

hasInputStream

public static boolean hasInputStream(javax.xml.transform.Source src)
Indicates whether the Source object has an InputStream instance.

Parameters:
src - the Source object
Returns:
true if an InputStream is available

xmlgraphics-commons 2.3

Copyright 1999-2018 The Apache Software Foundation. All Rights Reserved.