View Javadoc
1   /*
2    * Copyright 2013-2016 Brian Thomas Matthews
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package com.btmatthews.maven.plugins.ldap;
18  
19  import com.unboundid.ldif.LDIFChangeRecord;
20  import com.unboundid.ldif.LDIFException;
21  
22  import java.io.IOException;
23  
24  /**
25   * Implemented by objects that read change records from DSML or LDIF files.
26   *
27   * @author <a href="mailto:brian@btmatthews.com">Brian Matthews</a>
28   * @since 1.2.0
29   */
30  public interface FormatReader {
31  
32      /**
33       * Read the next change record from the underlying input stream.
34       *
35       * @return The next change record or {@code null} if the end of the input stream has been reached.
36       * @throws IOException   If there was an error reading from the input stream.
37       * @throws LDIFException If there was an error parsing the data read from the input stream.
38       */
39      LDIFChangeRecord nextRecord() throws IOException, LDIFException;
40  
41      /**
42       * Close the reader but not the underlying input stream.
43       *
44       * @throws IOException If there was an error closing the reader.
45       */
46      void close() throws IOException;
47  }