01: /*
02: * :tabSize=8:indentSize=8:noTabs=false:
03: * :folding=explicit:collapseFolds=1:
04: *
05: * Copyright (C) 2007 Kazutoshi Satoda
06: *
07: * This program is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU General Public License
09: * as published by the Free Software Foundation; either version 2
10: * of the License, or any later version.
11: * This program is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14: * GNU General Public License for more details.
15: *
16: * You should have received a copy of the GNU General Public License
17: * along with this program; if not, write to the Free Software
18: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19: */
20:
21: package org.gjt.sp.jedit.io;
22:
23: import java.io.InputStream;
24: import java.io.OutputStream;
25: import java.io.Reader;
26: import java.io.Writer;
27: import java.io.IOException;
28:
29: /**
30: * An interface to represent an encoding.
31: * An encoding is a mapping between a character stream and a byte
32: * stream. It is like java.nio.charset.Charset but has slightly
33: * different form. This can represents some extended encodings like
34: * UTF-8Y which drops (inserts) the BOM bytes before actual decoding
35: * (encoding). This also enables to add some extended encodings such
36: * as ASCII representation used by Java property files.
37: *
38: * @since 4.3pre10
39: * @author Kazutoshi Satoda
40: */
41: public interface Encoding {
42: /**
43: * Map an InputStream to a Reader.
44: */
45: public Reader getTextReader(InputStream in) throws IOException;
46:
47: /**
48: * Map an OutputStream to a Writer.
49: */
50: public Writer getTextWriter(OutputStream out) throws IOException;
51: }
|