Class ErrorLeaf

  • All Implemented Interfaces:
    Leaf, Node

    public class ErrorLeaf
    extends java.lang.Object
    implements Leaf
    Dummy Leaf implmentation which describes an error condition.
    Since:
    9 Sep 2005
    Author:
    Mark Taylor
    • Constructor Summary

      Constructors 
      Constructor Description
      ErrorLeaf​(Branch parent, java.lang.Throwable err)
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      uk.ac.starlink.util.DataSource getDataSource()
      Returns a data source (replayable input stream) containing the data content of this leaf.
      java.lang.String getName()
      Returns the name of this node.
      java.io.OutputStream getOutputStream()
      Returns an output stream from this leaf.
      Branch getParent()
      Returns the parent branch of this node.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • ErrorLeaf

        public ErrorLeaf​(Branch parent,
                         java.lang.Throwable err)
        Constructor.
        Parameters:
        parent - leaf parent
        err - the throwable which this leaf reprsents
    • Method Detail

      • getParent

        public Branch getParent()
        Description copied from interface: Node
        Returns the parent branch of this node. If this node is at the root of its tree, it will return null.
        Specified by:
        getParent in interface Node
        Returns:
        parent
      • getName

        public java.lang.String getName()
        Description copied from interface: Node
        Returns the name of this node. This should not be an entire pathname, that is, it should not include the name of its parent.
        Specified by:
        getName in interface Node
        Returns:
        name
      • getDataSource

        public uk.ac.starlink.util.DataSource getDataSource()
                                                     throws java.io.IOException
        Description copied from interface: Leaf
        Returns a data source (replayable input stream) containing the data content of this leaf.
        Specified by:
        getDataSource in interface Leaf
        Returns:
        data source
        Throws:
        java.io.FileNotFoundException - if the file named by this leaf does not exist
        java.io.IOException - if some other error occurs
      • getOutputStream

        public java.io.OutputStream getOutputStream()
                                             throws java.io.IOException
        Description copied from interface: Leaf
        Returns an output stream from this leaf. Whether the file named by this leaf already exists or not, the returned stream should effectively write to a new file (deleting an existing one if necessary).
        Specified by:
        getOutputStream in interface Leaf
        Returns:
        output stream writing to the file named by this leaf
        Throws:
        java.io.IOException - if there's some error
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object