TagFilter.java revision 9e81ea65408ad01e22a2c01118fd29139e20336b
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* See LICENSE.txt included in this distribution for the specific
* language governing permissions and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at LICENSE.txt.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/**
* A reader that reads only plain text from a HTML or XML file
*
* @author Chandan
*/
public class TagFilter extends FilterReader {
private boolean pass;
private int esc;
private boolean p;
private char[] esctag;
super(in);
pass = true;
esc = 0;
p = false;
esctag = new char[10];
}
int n=0;
int c;
n++;
}
return -1;
}
return n;
}
int c;
if (c == '<') {
pass = false;
} else if (c == '>') {
pass = true;
c = ' ';
} else if(pass && c == '&') {
esc = 0;
}
if(esc >= 0) {
if(c == ';') {
esc = -1;
p = false;
} else {
p = true;
return ' ';
}
} else if (sp) {
esc = -1;
} else {
if(esc < 10) {
} else {
esc = -1;
}
}
p = sp;
return c;
}
}
return -1;
}
return (ch <= 0x0020) &&
(((((1L << 0x0009) |
(1L << 0x000A) |
(1L << 0x000C) |
(1L << 0x000D) |
}
@SuppressWarnings("PMD.SystemPrintln")
String l;
}
}
}