Class LineBasedAdapter

  • All Implemented Interfaces:
    AdapterInterface, java.io.Serializable
    Direct Known Subclasses:
    CSVLineBasedAdapter

    public abstract class LineBasedAdapter
    extends SimpleAdapter
    Abstract adapter dedicated to line based input streams.
    This class (and its child classes) cannot be instanciated.
    They correspond to an Adapter configuration item.
    The only method to implement is the single line level processLine method:
    @Override
     public String processLine(long lineNumber, String line) throws PlatformException, InterruptedException {
         // return the line transformed into a Simplicité XML block or null to ignore (e.g. if the line has been processed within this method)
         return null;
     }
    See Also:
    Serialized Form
    • Constructor Detail

      • LineBasedAdapter

        public LineBasedAdapter()
    • Method Detail

      • readLine

        public java.lang.String readLine()
                                  throws java.io.IOException
        Default read line to the next line feed ('\n') or carriage return ('\r'). Method has to be overrided if the line is delimited by something else.
        Returns:
        Input line
        Throws:
        java.io.IOException
      • process

        public void process()
                     throws java.lang.InterruptedException
        Iterates input stream as individual lines.
        Each line is passed to the processLine method for processing.
        Throws:
        java.lang.InterruptedException
      • processLine

        public abstract java.lang.String processLine​(long lineNumber,
                                                     java.lang.String line)
                                              throws PlatformException,
                                                     java.lang.InterruptedException
        Line processing to implement.
        Parameters:
        lineNumber - Input line number (1 is the first line)
        line - Input line
        Returns:
        Processed line as XML statements or null
        Throws:
        PlatformException
        java.lang.InterruptedException