Package org.codehaus.swizzle.stream

Examples of org.codehaus.swizzle.stream.IncludeFilterInputStream


public class OReillyNewsGrabber implements NewsGrabber {
    public String getContent(String link) throws IOException {
        System.out.println("link " + link);
        URL url = new URL(link);
        InputStream in = new BufferedInputStream(url.openStream());
        in = new IncludeFilterInputStream(in, "/lpt", ">");
        StringBuffer text = new StringBuffer();

        int b;
        try {
            while ((b = in.read()) != -1 && b != '\"') {
                text.append((char) b);
            }
        } finally {
            in.close();
        }

        url = new URL(url, "/lpt" + text);
        text = new StringBuffer();

        // text.append(url.toExternalForm()+"</br>");
        // text.append(absoluteURL+"</br>");
        // text.append(relativeURL+"</br>");

        in = new BufferedInputStream(url.openStream());

        in = new IncludeFilterInputStream(in, "<HTML>", "</HTML>");
        in = new ExcludeFilterInputStream(in, "<HEAD", "/HEAD>");
        in = new ExcludeFilterInputStream(in, "<BODY", ">");
        in = new ExcludeFilterInputStream(in, "</BODY", ">");
        in = new ExcludeFilterInputStream(in, "<!--", "-->");
        in = new ExcludeFilterInputStream(in, "<SCRIPT", "</SCRIPT>");
View Full Code Here


    public String getContent(String link) throws IOException {
        System.out.println(link);

        URL url = new URL(link);
        InputStream in = new BufferedInputStream(url.openStream());
        in = new IncludeFilterInputStream(in, "SIZE=\"4\" COLOR=\"#FFFFFF\">", "<p>");
        in = new ExcludeFilterInputStream(in, "</FONT></TD>", "</TABLE>");
        in = new ExcludeFilterInputStream(in, "<!--", "-->");
        in = new ExcludeFilterInputStream(in, "<TABLE", "</TABLE>");
        StringBuffer text = new StringBuffer();
View Full Code Here

    public String getContent(String link) throws IOException {
        link = link.replaceFirst("article.pl", "print.pl");

        URL url = new URL(link);
        InputStream in = new BufferedInputStream(url.openStream());
        in = new IncludeFilterInputStream(in, "<HTML>", "</HTML>");
        in = new ExcludeFilterInputStream(in, "<HEAD", "/HEAD>");
        in = new ExcludeFilterInputStream(in, "<BODY", ">");
        in = new ExcludeFilterInputStream(in, "</BODY", ">");
        in = new ExcludeFilterInputStream(in, "<!--", "-->");
        in = new ExcludeFilterInputStream(in, "<SCRIPT", "</SCRIPT>");
View Full Code Here

            in = new ReplaceStringInputStream(in, "\n", "");
            in = new ReplaceStringInputStream(in, "\r", "");
            in = new ReplaceStringInputStream(in, "<tr", "\n<tr");
            in = new ReplaceStringInputStream(in, "</tr>", "</tr>\n");
            in = new GrepStream(in, "issue_subtask.gif");
            in = new IncludeFilterInputStream(in, "<ahref", ">");
            in = new DelimitedTokenReplacementInputStream(in, "browse/", "\"", new CollectTokensHandler(issueIds));

            int i = in.read();
            while (i != -1) {
                i = in.read();
View Full Code Here

            URL baseUrl = new URL(baseUrlString);

            URL url = new URL(baseUrl, "secure/ViewVoters!default.jspa?id=" + issue.getId());

            InputStream in = new BufferedInputStream(url.openStream());
            in = new IncludeFilterInputStream(in, "<a id=\"voter_link", "/a>");
            in = new DelimitedTokenReplacementInputStream(in, "name=", "<", new StringTokenHandler() {
                public String handleToken(String token) throws IOException {
                    String[] s = token.split("\">");
                    try {
                        User user;
View Full Code Here

TOP

Related Classes of org.codehaus.swizzle.stream.IncludeFilterInputStream

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.