KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ccil > cowan > tagsoup > AutoDetector


1 // This file is part of TagSoup.
2
//
3
// This program is free software; you can redistribute it and/or modify
4
// it under the terms of the GNU General Public License as published by
5
// the Free Software Foundation; either version 2 of the License, or
6
// (at your option) any later version. You may also distribute
7
// and/or modify it under version 2.1 of the Academic Free License.
8
//
9
// This program 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.
12
//
13
//
14
// Interface to objects that translate InputStreams to Readers by auto-detection
15

16 package org.ccil.cowan.tagsoup;
17 import java.io.Reader JavaDoc;
18 import java.io.InputStream JavaDoc;
19
20 /**
21 Classes which accept an InputStream and provide a Reader which figures
22 out the encoding of the InputStream and reads characters from it should
23 conform to this interface.
24 @see java.io.InputStream
25 @see java.io.Reader
26 */

27
28 public interface AutoDetector {
29
30     /**
31     Given an InputStream, return a suitable Reader that understands
32     the presumed character encoding of that InputStream.
33     If bytes are consumed from the InputStream in the process, they
34     <i>must</i> be pushed back onto the InputStream so that they can be
35     reinterpreted as characters.
36     @param i The InputStream
37     @return A Reader that reads from the InputStream
38     */

39
40     public Reader JavaDoc autoDetectingReader(InputStream JavaDoc i);
41
42     }
43
Popular Tags