Welcome![Sign In][Sign Up]
Location:
Search - getmessage

Search list

[assembly languagetestwin.zip

Description: 如何编写小于20K的Windows程序.演示如何使用:CreateWindow, CreateWindowEx, S endMessage and GetMessage TranslateMessage and DispatchMessage, CreateFont 演示如何使用API创建Windows窗口控件
Platform: | Size: 13126 | Author: | Hits:

[Internet-Network用Java编写HTML文件分析程序

Description:

Java编写HTML文件分析程序

 一、概述

    

    Web服务器的核心是对Html文件中的各标记(Tag)作出正确的分析,一种编程语言的解释程序也是对源文件中的保留字进行分析再做解释的。实际应用中,我们也经常会碰到需要对某一特定类型文件进行要害字分析的情况,比如,需要将某个HTML文件下载并同时下载与之相关的.gif.class等文件,此时就要求对HTML文件中的标记进行分离,找出所需的文件名及目录。在Java出现以前,类似工作需要对文件中的每个字符进行分析,从中找出所需部分,不仅编程量大,且易出错。笔者在近期的项目中利用Java的输入流类StreamTokenizer进行HTML文件的分析,效果较好。在此,我们要实现从已知的Web页面下载HTML文件,对其进行分析后,下载该页面中包含的HTML文件(假如在Frame中)、图像文件和ClassJava Applet)文件。

    

    二、StreamTokenizer

    

    StreamTokenizer即令牌化输入流的作用是将一个输入流中变成令牌流。令牌流中的令牌实体有三类:单词(即多字符令牌)、单字符令牌和空白(包括JavaC/C++中的说明语句)。

    

    StreamTokenizer类的构造器为: StreamTokenizer(InputStream in)

    

    该类有一些公有实例变量:ttypesvalnval ,分别表示令牌类型、当前字符串值和当前数字值。当我们需要取得令牌(即HTML中的标记)之间的字符时,应访问变量sval。而读向下一个令牌的方法是调用nextToken()。方法nextToken()的返回值是int型,共有四种可能的返回:

    

    StreamTokenizer.TT_NUMBER: 表示读到的令牌是数字,数字的值是double型,可以从实例变量nval中读取。

    

    StreamTokenizer.TT_Word: 表示读到的令牌是非数字的单词(其他字符也在其中),单词可以从实例变量sval中读取。

    

    StreamTokenizer.TT_EOL: 表示读到的令牌是行结束符。

    

    假如已读到流的尽头,则nextToken()返回TT_EOF

    

    开始调用nextToken()之前,要设置输入流的语法表,以便使分析器辨识不同的字符。WhitespaceChars(int low, int hi)方法定义没有意义的字符的范围。WordChars(int low, int hi)方法定义构造单词的字符范围。

    

    三、程序实现

    

    1HtmlTokenizer类的实现

    

    对某个令牌流进行分析之前,首先应对该令牌流的语法表进行设置,在本例中,即是让程序分出哪个单词是HTML的标记。下面给出针对我们需要的HTML标记的令牌流类定义,它是StreamTokenizer的子类:

    

    

    import java.io.*;

    import java.lang.String;

    class HtmlTokenizer extends

    StreamTokenizer {

    //定义各标记,这里的标记仅是本例中必须的,

    可根据需要自行扩充

     static int HTML_TEXT=-1;

     static int HTML_UNKNOWN=-2;

     static int HTML_EOF=-3;

     static int HTML_IMAGE=-4;

     static int HTML_FRAME=-5;

     static int HTML_BACKGROUND=-6;

     static int HTML_APPLET=-7;

    

    boolean outsideTag=true; //判定是否在标记之中

    

     //构造器,定义该令牌流的语法表。

     public HtmlTokenizer(BufferedReader r) {

    super(r);

    this.resetSyntax(); //重置语法表

    this.wordChars(0,255); //令牌范围为全部字符

    this.ordinaryChar('< '); //HTML标记两边的分割符

    this.ordinaryChar('>');

     } //end of constrUCtor

    

     public int nextHtml(){

    int token; //令牌

    try{

    switch(token=this.nextToken()){

    case StreamTokenizer.TT_EOF:

    //假如已读到流的尽头,则返回TT_EOF

    return HTML_EOF;

    case '< ': //进入标记字段

    outsideTag=false;

    return nextHtml();

    case '>': //出标记字段

    outsideTag=true;

    return nextHtml();

    case StreamTokenizer.TT_WORD:

    //若当前令牌为单词,判定是哪个标记

    if (allWhite(sval))

     return nextHtml(); //过滤其中空格

    else if(sval.toUpperCase().indexOf("FRAME")

    !=-1 && !outsideTag) //标记FRAME

     return HTML_FRAME;

    else if(sval.toUpperCase().indexOf("IMG")

    !=-1 && !outsideTag) //标记IMG

     return HTML_IMAGE;

    else if(sval.toUpperCase().indexOf("BACKGROUND")

    !=-1 && !outsideTag) //标记BACKGROUND

     return HTML_BACKGROUND;

    else if(sval.toUpperCase().indexOf("APPLET")

    !=-1 && !outsideTag) //标记APPLET

     return HTML_APPLET;

    default:

    System.out.println ("Unknown tag: "+token);

    return HTML_UNKNOWN;

     } //end of case

    }catch(IOException e){

    System.out.println("Error:"+e.getMessage());}

    return HTML_UNKNOWN;

     } //end of nextHtml

    

    protected boolean allWhite(String s){//过滤所有空格

    //实现略

     }// end of allWhite

    

    } //end of class

    

    以上方法在近期项目中测试通过,操作系统为Windows NT4,编程工具使用Inprise Jbuilder3


Platform: | Size: 1066 | Author: tiberxu | Hits:

[Windows DevelopGetMessagAndPeekMessage

Description: 深入GetMessage和PeekMessage-depth GetMessage and PeekMessage
Platform: | Size: 12470 | Author: 董秋芳 | Hits:

[Other resourcekbhookdll

Description: wince 下的hook 程序 进行系统 GetMessage的拦截,本例进行WM_TEXT 拦截-wince under the hook GetMessage procedures for the interception system, WM_TEXT cases for the interceptor
Platform: | Size: 28180 | Author: whathappenif | Hits:

[Other resourcegetMessage

Description: 网络测量是通过收集数据或分组的踪迹定量分析不同的网络应用在网络中的分组活动情况的技术。 通过网络测量,可以更加有效地认识和了解网络的性能,进行高效的网络性能管理;可以发现网络故障并对其进行迅速定位;可以检测拥塞链路,预警拒绝服务攻击,实施流量工程,满足服务等级合同的高效QOS策略设计及实现多种形式科学计费。此外,网络测量还是建立网络流量模型的重要手段。因此,网络测量对于网络管理、流量模型的建立、网络行为的理解、网络规划等方面都有重要意义。
Platform: | Size: 1173 | Author: fafa | Hits:

[assembly languagetestwin

Description: 如何编写小于20K的Windows程序.演示如何使用:CreateWindow, CreateWindowEx, S endMessage and GetMessage TranslateMessage and DispatchMessage, CreateFont 演示如何使用API创建Windows窗口控件- How compiles is smaller than the 20K Windows procedure How demonstrates uses: CreateWindow, CreateWindowEx, S endMessage and GetMessage TranslateMessage and DispatchMessage, how does CreateFont demonstrate uses API to found the Windows window to control
Platform: | Size: 13312 | Author: 刘豫晋 | Hits:

[Windows DevelopGetMessagAndPeekMessage

Description: 深入GetMessage和PeekMessage-depth GetMessage and PeekMessage
Platform: | Size: 12288 | Author: 董秋芳 | Hits:

[Windows CEkbhookdll

Description: wince 下的hook 程序 进行系统 GetMessage的拦截,本例进行WM_TEXT 拦截-wince under the hook GetMessage procedures for the interception system, WM_TEXT cases for the interceptor
Platform: | Size: 27648 | Author: whathappenif | Hits:

[SNMPgetMessage

Description: 网络测量是通过收集数据或分组的踪迹定量分析不同的网络应用在网络中的分组活动情况的技术。 通过网络测量,可以更加有效地认识和了解网络的性能,进行高效的网络性能管理;可以发现网络故障并对其进行迅速定位;可以检测拥塞链路,预警拒绝服务攻击,实施流量工程,满足服务等级合同的高效QOS策略设计及实现多种形式科学计费。此外,网络测量还是建立网络流量模型的重要手段。因此,网络测量对于网络管理、流量模型的建立、网络行为的理解、网络规划等方面都有重要意义。
Platform: | Size: 1024 | Author: fafa | Hits:

[JSP/JavaGetMail

Description: javamail的应用,MailServer类可单独应用,GetMessage不完整,主要描述MailServer的应用-javamail application, MailServer can be a separate type of application, GetMessage incomplete application describes MailServer
Platform: | Size: 5120 | Author: 丁麟翔 | Hits:

[CSharpSendMessage

Description: 一个sendmessage与getmessage的简单示例-Sendmessage with a simple example getmessage
Platform: | Size: 21504 | Author: 王祥 | Hits:

[Hook apiPasswordSpy

Description: PasswordSpy 程序最有趣的部分其实是使用 SetWindowsHookEx API.函数设置Windows 钩子。利用该函数你可以将钩子安装到操作系统中或者某个特定的进程中。钩子的种类有很多种,每种钩子作用也不尽相同,用来监视特定的一组事件。当某一类事件发生时,钩子代码被调用。PasswordSpy使用WH_GETMESSAGE钩子,它监视对GetMessage 和PeekMessage 的调用.-PasswordSpy is a program that will allow you to "see" the password that is behind the "****" edit boxes. This program is not a "password cracker." Instead PasswordSpy takes advantage of several advanced techniques in Windows that allow one program to copy the password from another. This program is not intended for mischievous purposes. PasswordSpy can copy the password from most Windows programs. Some exceptions are the Windows logon screen, Windows NT services, and most non-standard Windows applications (like Java apps).
Platform: | Size: 39936 | Author: yuan | Hits:

[VC/MFCprogramdesign

Description: Windows编程基础 源程序组成结构 MFC编程基础 鼠标应用程序实例 消息映射-PostMessage() The PostMessage function places (posts) a message in the message queue associated with the thread that created the specified window and then returns without waiting for the thread to process the message. Messages in a message queue are retrieved by calls to the GetMessage or PeekMessage function. BOOL PostMessage( HWND hWnd, // handle of destination window UINT Msg, // message to post WPARAM wParam, // first message parameter LPARAM lParam // second message parameter ) 其中 hWnd Handle to the window whose window procedure is to receive the message. Two values have special meanings: ValueMeaningHWND_BROADCASTThe message is posted to all top-level windows in the system, including disabled or invisible unowned windows, overlapped windows, and pop-up windows. The message is not posted to child windows.NULLThe function behaves like a call to PostThreadMessage with the dwThreadId parameter set to the identifier of the current thread. Msg Specifies the messa
Platform: | Size: 479232 | Author: 李毅 | Hits:

[Dialog_Windowtestwin

Description: 如何在Delphi中编写小于20K的Windows程序. 演示如何使用: CreateWindow,CreateWindowEx,SendMessage and GetMessage TranslateMessage and DispatchMessage, CreateFont 演示如何使用API创建Windows窗口控件-How to Delphi in the preparation of the Windows program is less than 20K. Demonstrate how to use: CreateWindow, CreateWindowEx, SendMessage and GetMessage TranslateMessage and DispatchMessage, CreateFont demonstration how to use the API to create Windows window control
Platform: | Size: 12288 | Author: richardw | Hits:

[Windows Developgetmessage

Description: VB做的一个获取系统的信息,希望对大家学习VB编程有用-VB do a acquisition system for all the information that is useful learning VB
Platform: | Size: 5120 | Author: 徐盼盼 | Hits:

[JSP/Javacar

Description: GUI Driver CarPark.java:287: cannot find symbol symbol : class IllegalOperationException location: class ro.polak.multilevelcarpark.controllers.CarPark catch(IllegalOperationException e){gui.simpleDialog("System Illegal Operation", e.getMessage()) } ^ CarPark.java:288: cannot find symbol symbol : class CarNotFoundException location: class ro.polak.multilevelcarpark.controllers.CarPark catch(CarNotFoundException e){gui.simpleDialog("404 Car Not Found", "There is no such car in the park") } ^ CarPark.java:302: cannot find symbol symbol : variable CarParkSingleton location: class ro.polak.multilevelcarpark.controllers.CarPark CarParkSingleton.getCarPark() -GUI Driver CarPark.java:287: cannot find symbol symbol : class IllegalOperationException location: class ro.polak.multilevelcarpark.controllers.CarPark catch(IllegalOperationException e){gui.simpleDialog("System Illegal Operation", e.getMessage()) } ^ CarPark.java:288: cannot find symbol symbol : class CarNotFoundException location: class ro.polak.multilevelcarpark.controllers.CarPark catch(CarNotFoundException e){gui.simpleDialog("404 Car Not Found", "There is no such car in the park") } ^ CarPark.java:302: cannot find symbol symbol : variable CarParkSingleton location: class ro.polak.multilevelcarpark.controllers.CarPark CarParkSingleton.getCarPark()
Platform: | Size: 1024 | Author: ahmed | Hits:

[CommunicationGetMessage

Description: 简单的windows不同窗口之间的message通信,适合初级学习者-Simple Windows of the message communication between different window, suitable for primary learners
Platform: | Size: 10371072 | Author: 梅西 | Hits:

[Delphi VCLGetMessage

Description: Message Hooker With this component you can hook messages from other WinControls.
Platform: | Size: 181248 | Author: AliReza | Hits:

[JSP/Javajavaerrorone

Description: java自定义异常实例(一)。 public class CustomException_02 { public static void main(String[] args) { try { customException() formatThrowable() } catch (CustomException e1) { // 捕获CustomException异常 System.out.println("Exception: " + e1.getMessage()) e1.printStackTrace() // 输出异常信息 } catch (FormatThrowable e2) { // 捕获FormatThrowable异常 System.out.println("Exception: " + e2.getMessage()) -java custom exception instance (a).
Platform: | Size: 60416 | Author: 小伟 | Hits:

[JSP/Javajavaerrortwo

Description: java自定义异常实例(二)。 public class CustomException_02 { public static void main(String[] args) { try { customException() formatThrowable() } catch (CustomException e1) { // 捕获CustomException异常 System.out.println("Exception: " + e1.getMessage()) e1.printStackTrace() // 输出异常信息 } catch (FormatThrowable e2) { // 捕获FormatThrowable异常-java custom exception instance (two).
Platform: | Size: 60416 | Author: 小伟 | Hits:
« 12 »

CodeBus www.codebus.net