Examples of StreamLexer


Examples of org.codehaus.swizzle.stream.StreamLexer

            URL baseUrl = new URL(baseUrlString);

            URL pageUrl = new URL(baseUrl, "secure/ManageAttachments.jspa?id=" + issue.getId());

            InputStream in = new BufferedInputStream(pageUrl.openStream());
            StreamLexer lexer = new StreamLexer(in);

            while (lexer.readToken("icons/attach") != null) {
                try {
                    Attachment attachment = new Attachment();

                    String link = lexer.readToken("secure/attachment/", "\"");
                    URL url = new URL(pageUrl, "attachment/" + link);
                    attachment.setUrl(url);
                    attachments.add(attachment);

                    String id = link.replaceFirst("/.*", "");
                    attachment.setId(Integer.parseInt(id));

                    File file = new File(url.getFile());
                    attachment.setFileName(file.getName());

                    lexer.readToken("<td");
                    String size = lexer.readToken(">", "</td>");

                    lexer.readToken("<td");
                    String mimeType = lexer.readToken(">", "</td>");

                    try {
                        lexer.readToken("<td");
                        String dateAttached = lexer.readToken(">", "</td>");
                        if (!containsGarbage(dateAttached)) {
                            // 12/Sep/06 02:23 PM - dd/MMM/yy hh:mm a
                            Date created = dateFormat.parse(dateAttached);
                            attachment.setCreated(created);
                        }
                    } catch (Exception e) {
                    }

                    lexer.readToken("<td");
                    String attachedBy = lexer.readToken(">", "</td>");
                    if (!containsGarbage(attachedBy)) {
                        attachment.setAuthor(attachedBy);
                    } else {
                        attachment.setAuthor("");
                    }
View Full Code Here

Examples of xnap.plugin.gift.net.lexer.StreamLexer

    private void process()
    {
        OutputStream out;
        InputStream in;
        StreamLexer lexer;

        try {
            if (socket == null) {
                socket = new Socket(host, port);
            } else { // FIX: if (!socket.isConnected()) {
                socket = new Socket(host, port);
            }

            connectState = CONNECTING;
        } catch (IOException e) {
            connectState = OFFLINE;
            fireEvent(new ErrorEvent("giFT daemon not running", e));
            fireEvent(new OfflineEvent());

            return;
        }

        try {
            out = socket.getOutputStream();
            in = socket.getInputStream();
            lexer = new StreamLexer(in);

            Command cmd = new Command("attach");
            cmd.addKey("client", "XNap");
            cmd.addKey("version", XNap.VERSION);

            if (user != null) {
                cmd.addKey("profile", user);
            }

            queueCommand(cmd);
            cmd = null;

            while (!exitProcessThread) {
                Thread.sleep(10);

                if (false) { // FIX : !socket.isConnected()

                    break;
                }

                if (in.available() != 0) {
                    cmd = lexer.parse();

                    if (debug) {
                        fireEvent(new DebugEvent(DebugEvent.RECEIVE, cmd));
                    }
View Full Code Here

Examples of xnap.plugin.gift.net.lexer.StreamLexer

        setStatus(STATUS_CONNECTED);
        //SearchManager.getInstance().availability(1);

        try {
            lexer = new StreamLexer(socket.getInputStream());
          //socket.getOutputStream().write(ProtocolHelper.getStats());
            socket.getOutputStream().write(ProtocolHelper.getStats());

            // read giFT version
            //  in.readLine();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.