WEB开发网
开发学院数据库MSSQL Server FOXPRO 系统指标 阅读

FOXPRO 系统指标

 2007-11-11 09:53:10 来源:WEB开发网   
核心提示: 原文出处终于整理完dbf文件读写的java源码,欢迎使用 修改以下代码 private void init(InputStream inputstream) throws JDBFException { try { stream = new DataInputStream(inputs

原文出处

终于整理完dbf文件读写的java源码,欢迎使用



修改以下代码



   private void init(InputStream inputstream)     throws JDBFException   {     try     {       stream = new DataInputStream(inputstream);       int i = readHeader();       fields = new JDBField[i];       int j = 1;       for(int k = 0; k < i; k++)       {         fields[k] = readFieldHeader();         j += fields[k].getLength();       }

             if(stream.read() < 1)         throw new JDBFException("Unexpected end of file reached.");       nextRecord = new byte[j];       try       {         //stream.readFully(nextRecord);         stream.read(new byte[263]);         stream.readFully(nextRecord);       }       catch(EOFException eofexception)       {         nextRecord = null;         stream.close();       }     }     catch(IOException ioexception)     {       throw new JDBFException(ioexception);     }   }



   private int readHeader()     throws IOException, JDBFException   {     byte abyte0[] = new byte[16];     try     {       stream.readFully(abyte0);     }     catch(EOFException eofexception)     {       throw new JDBFException("Unexpected end of file reached.");     }     int i = abyte0[8];     if(i < 0)       i += 256;     i += 256 * abyte0[9];     i -= 264;     i = --i / 32;     //i = --i / 32;     //i--;    try     {       stream.readFully(abyte0);     }     catch(EOFException eofexception1)     {       throw new JDBFException("Unexpected end of file reached.");     }     return i;   }



dbf文件定义格式:http://www.clicketyclick.dk/databases/xbase/format/dbf.HTML

上一页  2 3 4 5 6 7 8 9 10 11  下一页

Tags:FOXPRO 指标

编辑录入:coldstar [复制链接] [打 印]
赞助商链接