View Javadoc
1   /*
2   Copyright (c) 2010 James Ahlborn
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.healthmarketscience.jackcess.impl;
18  
19  import java.io.IOException;
20  import java.nio.charset.Charset;
21  
22  /**
23   * Interface for a provider which can generate CodecHandlers for various types
24   * of database encodings.  The {@link DefaultCodecProvider} is the default
25   * implementation of this inferface, but it does not have any actual
26   * encoding/decoding support (due to possible export issues with calling
27   * encryption APIs).  See the separate
28   * <a href="https://sourceforge.net/projects/jackcessencrypt/">Jackcess
29   * Encrypt</a> project for an implementation of this interface which supports
30   * various access database encryption types.
31   *
32   * @author James Ahlborn
33   */
34  public interface CodecProvider 
35  {
36    /**
37     * Returns a new CodecHandler for the database associated with the given
38     * PageChannel.
39     * 
40     * @param channel the PageChannel for a Database
41     * @param charset the Charset for the Database
42     * 
43     * @return a new CodecHandler, may not be {@code null}
44     */
45    public CodecHandler createHandler(PageChannel channel, Charset charset)
46      throws IOException;
47  }