1 /**
2  *  ServingXML
3  *
4  *  Copyright (C) 2006  Daniel Parker
5  *    daniel.parker@servingxml.com
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  **/
20 
21 package com.servingxml.components.flatfile.options;
22 
23 import java.io.IOException;
24 
25 import com.servingxml.components.flatfile.options.CharBuffer;
26 import com.servingxml.components.flatfile.scanner.characters.CharInput;
27 import com.servingxml.util.CharArrayBuilder;
28 
29 public interface QuoteSymbolCharChecker {
30   public final static QuoteSymbolCharChecker NULL = new NullCharQuoteSymbolChecker();
31 
foundEscapedQuoteSymbol(CharBuffer recordBuffer, CharArrayBuilder charArrayBuilder)32   boolean foundEscapedQuoteSymbol(CharBuffer recordBuffer, CharArrayBuilder charArrayBuilder)
33   throws IOException;
34 
foundEscapedQuoteSymbol(char[] data, int start, int length)35   int foundEscapedQuoteSymbol(char[] data, int start, int length)
36   throws IOException;
37 
readEscapedQuoteSymbol(char[] data, int start, int length, CharArrayBuilder charArrayBuilder)38   int readEscapedQuoteSymbol(char[] data, int start, int length, CharArrayBuilder charArrayBuilder)
39   throws IOException;
40 
foundQuoteSymbol(CharBuffer recordBuffer, CharArrayBuilder charArrayBuilder)41   boolean foundQuoteSymbol(CharBuffer recordBuffer, CharArrayBuilder charArrayBuilder)
42   throws IOException;
43 
foundQuoteSymbol(char[] data, int start, int length)44   int foundQuoteSymbol(char[] data, int start, int length)
45   throws IOException;
46 
length()47   int length();
48 }
49 
50 final class NullCharQuoteSymbolChecker implements QuoteSymbolCharChecker {
foundEscapedQuoteSymbol(CharBuffer recordBuffer, CharArrayBuilder charArrayBuilder)51   public final boolean foundEscapedQuoteSymbol(CharBuffer recordBuffer, CharArrayBuilder charArrayBuilder)
52   throws IOException {
53     return false;
54   }
55 
foundEscapedQuoteSymbol(char[] data, int start, int length)56   public final int foundEscapedQuoteSymbol(char[] data, int start, int length)
57   throws IOException {
58     return 0;
59   }
60 
readEscapedQuoteSymbol(char[] data, int start, int length, CharArrayBuilder charArrayBuilder)61   public final int readEscapedQuoteSymbol(char[] data, int start, int length, CharArrayBuilder charArrayBuilder)
62   throws IOException {
63     return 0;
64   }
65 
foundQuoteSymbol(CharBuffer recordBuffer, CharArrayBuilder charArrayBuilder)66   public final boolean foundQuoteSymbol(CharBuffer recordBuffer, CharArrayBuilder charArrayBuilder)
67   throws IOException {
68     return false;
69   }
70 
foundQuoteSymbol(char[] data, int start, int length)71   public final int foundQuoteSymbol(char[] data, int start, int length)
72   throws IOException {
73     return 0;
74   }
75 
length()76   public int length() {
77     return 0;
78   }
79 }
80 
81