readrow.java

来自「我自己做的一个关于使用Ethereal抓包软件抓取SIP协议包后自己的协议分析软」· Java 代码 · 共 56 行

JAVA
56
字号
/*
 * Readrow.java
 *
 * Created on 2007年5月23日, 下午1:43
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package SIPRead;


import java.io.*;
import java.util.*;
/**
 *
 * @author Administrator
 */
public class Readrow {
    
    private  int data = 0;
    private RandomAccessFile indata;
    
    /**
     * Creates a new instance of Readrow
     */
    public Readrow(File file) {
        try{
        indata = new RandomAccessFile(file,"r");
        }
        catch(IOException e){
            System.out.println(e);
        }
    }
    
    /*获取一行数据*/
    public String Next(){
        int a = 0;
        String temp= null;
        try{
        if((a  = indata.read())!=-1){
             indata.seek(indata.getFilePointer()-1);
             temp = indata.readLine();
        }
        else{
            temp = "!q2w378$";
        }
        }
        catch(IOException e){
            System.out.println(e);
        }
        return temp;
    }
    
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?