Class CacheRowPipe

  • All Implemented Interfaces:
    uk.ac.starlink.table.RowPipe, uk.ac.starlink.table.TableSink

    public class CacheRowPipe
    extends java.lang.Object
    implements uk.ac.starlink.table.RowPipe
    RowPipe implementation which caches the data to provide a random-access StarTable.

    The current implementation simply delegates to a OnceRowPipe and caches the result before returning it from waitForStarTable. This is crude, and means that the output rows don't start to come until all the input rows have been written to the pipe (so there's not much point using a pipe). A future implementation should get smarter with threads to improve this.

    Since:
    14 Oct 2011
    Author:
    Mark Taylor
    • Constructor Summary

      Constructors 
      Constructor Description
      CacheRowPipe()
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void acceptMetadata​(uk.ac.starlink.table.StarTable meta)  
      void acceptRow​(java.lang.Object[] row)  
      void endRows()  
      void setError​(java.io.IOException err)  
      uk.ac.starlink.table.StarTable waitForStarTable()
      Returns a multiply-readable random access table.
      • Methods inherited from class java.lang.Object

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

      • CacheRowPipe

        public CacheRowPipe()
        Constructor.
    • Method Detail

      • acceptMetadata

        public void acceptMetadata​(uk.ac.starlink.table.StarTable meta)
                            throws uk.ac.starlink.table.TableFormatException
        Specified by:
        acceptMetadata in interface uk.ac.starlink.table.TableSink
        Throws:
        uk.ac.starlink.table.TableFormatException
      • acceptRow

        public void acceptRow​(java.lang.Object[] row)
                       throws java.io.IOException
        Specified by:
        acceptRow in interface uk.ac.starlink.table.TableSink
        Throws:
        java.io.IOException
      • endRows

        public void endRows()
                     throws java.io.IOException
        Specified by:
        endRows in interface uk.ac.starlink.table.TableSink
        Throws:
        java.io.IOException
      • setError

        public void setError​(java.io.IOException err)
        Specified by:
        setError in interface uk.ac.starlink.table.RowPipe
      • waitForStarTable

        public uk.ac.starlink.table.StarTable waitForStarTable()
                                                        throws java.io.IOException
        Returns a multiply-readable random access table.
        Specified by:
        waitForStarTable in interface uk.ac.starlink.table.RowPipe
        Returns:
        random access, multiply readable table with the same content as the rows accepted by this pipe
        Throws:
        java.io.IOException