Mercurial > hg > fulltextIndexer
comparison src/de/mpiwg/dwinter/lucencetools/analyzer/.svn/text-base/XMLFilteredReader.java.svn-base @ 0:dc7622afcfea default tip
initial
author | dwinter |
---|---|
date | Wed, 03 Nov 2010 12:33:16 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:dc7622afcfea |
---|---|
1 /* */ package de.mpiwg.dwinter.lucencetools.analyzer; | |
2 /* */ | |
3 /* */ | |
4 /* */ import java.io.IOException; | |
5 /* */ import java.io.InputStream; | |
6 /* */ import java.io.InputStreamReader; | |
7 /* */ import java.io.UnsupportedEncodingException; | |
8 /* */ | |
9 /* */ public class XMLFilteredReader extends InputStreamReader | |
10 /* */ { | |
11 /* */ public XMLFilteredReader(InputStream in, String charsetName) | |
12 /* */ throws UnsupportedEncodingException | |
13 /* */ { | |
14 /* 12 */ super(in, charsetName); | |
15 /* */ } | |
16 /* */ | |
17 /* */ public int read() throws IOException | |
18 /* */ { | |
19 /* 17 */ int c = super.read(); | |
20 /* 18 */ if (c == -1) { | |
21 /* 19 */ return c; | |
22 /* */ } | |
23 /* 21 */ boolean isXML = false; | |
24 /* */ | |
25 /* 23 */ if (c == 60) | |
26 /* 24 */ isXML = true; | |
27 /* 25 */ while (isXML) { | |
28 /* 26 */ c = super.read(); | |
29 /* 27 */ if (c == -1) | |
30 /* 28 */ return c; | |
31 /* 29 */ if (c == 62) { | |
32 /* 30 */ isXML = false; | |
33 /* */ } | |
34 /* */ } | |
35 /* 33 */ return super.read(); | |
36 /* */ } | |
37 /* */ | |
38 /* */ public int read(char[] cbuf, int offset, int length) throws IOException | |
39 /* */ { | |
40 /* 38 */ char[] cbuf2 = new char[cbuf.length]; | |
41 /* 39 */ int i = 0; | |
42 /* 40 */ int retLen = super.read(cbuf2, offset, length); | |
43 /* 41 */ if (retLen <= 0) { | |
44 /* 42 */ cbuf = (char[])cbuf2.clone(); | |
45 /* 43 */ return retLen; | |
46 /* */ } | |
47 /* 45 */ boolean isXML = false; | |
48 /* 46 */ for (char c : cbuf2) { | |
49 /* 47 */ if (c == '<') { | |
50 /* 48 */ isXML = true; | |
51 /* */ } | |
52 /* 50 */ //if (c == '\0/7') { | |
53 /* */ // break; | |
54 /* */ //} | |
55 /* 53 */ if (!isXML) { | |
56 /* 54 */ cbuf[i] = c; | |
57 /* 55 */ ++i; | |
58 /* */ } | |
59 /* 57 */ if (c == '>') { | |
60 /* 58 */ isXML = false; | |
61 /* */ } | |
62 /* */ | |
63 /* */ } | |
64 /* */ | |
65 /* 63 */ return i; | |
66 /* */ } | |
67 /* */ } | |
68 | |
69 /* Location: /private/tmp/fulltextIndexer.jar | |
70 * Qualified Name: de.mpiwg.dwinter.lucencetools.analyzer.XMLFilteredReader | |
71 * JD-Core Version: 0.5.4 | |
72 */ |