View Javadoc

1   /*
2   Copyright (c) 2010 James Ahlborn
3   
4   This library is free software; you can redistribute it and/or
5   modify it under the terms of the GNU Lesser General Public
6   License as published by the Free Software Foundation; either
7   version 2.1 of the License, or (at your option) any later version.
8   
9   This library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  Lesser General Public License for more details.
13  
14  You should have received a copy of the GNU Lesser General Public
15  License along with this library; if not, write to the Free Software
16  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
17  USA
18  */
19  
20  package com.healthmarketscience.jackcess;
21  
22  import java.io.IOException;
23  import java.nio.charset.Charset;
24  
25  /**
26   * Interface for a provider which can generate CodecHandlers for various types
27   * of database encodings.  The {@link DefaultCodecProvider} is the default
28   * implementation of this inferface, but it does not have any actual
29   * encoding/decoding support (due to possible export issues with calling
30   * encryption APIs).  See the separate
31   * <a href="https://sourceforge.net/projects/jackcessencrypt/">Jackcess
32   * Encrypt</a> project for an implementation of this interface which supports
33   * various access database encryption types.
34   *
35   * @author James Ahlborn
36   */
37  public interface CodecProvider 
38  {
39    /**
40     * Returns a new CodecHandler for the database associated with the given
41     * PageChannel.
42     * 
43     * @param channel the PageChannel for a Database
44     * @param charset the Charset for the Database
45     * 
46     * @return a new CodecHandler, may not be {@code null}
47     */
48    public CodecHandler createHandler(PageChannel channel, Charset charset)
49      throws IOException;
50  }