View Javadoc
1   /*
2    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
3    * The software in this package is published under the terms of the CPAL v1.0
4    * license, a copy of which has been included with this distribution in the
5    * LICENSE.txt file.
6    */
7   package org.mule.transport.tcp.protocols;
8   
9   /**
10   * Extend {@link org.mule.transport.tcp.protocols.XmlMessageProtocol} to continue reading
11   * until either a new message or EOF is found.
12   */
13  public class XmlMessageEOFProtocol extends XmlMessageProtocol
14  {
15  
16      /**
17       * Continue reading til EOF or new document found
18       *
19       * @param patternIndex The index of the xml tag (or -1 if the next message not found)
20       * @param len The amount of data read this loop (or -1 if EOF)
21       * @param available The amount of data available to read
22       * @return true if the read should continue
23       */
24      @Override
25      protected boolean isRepeat(int patternIndex, int len, int available)
26      {
27          return patternIndex < 0;
28      }
29  
30  }