使用java实现对dbf文件的简单读写

使用java实现对dbf文件的简单读写

ID:6037117

大小:104.50 KB

页数:20页

时间:2017-12-31

使用java实现对dbf文件的简单读写_第1页
使用java实现对dbf文件的简单读写_第2页
使用java实现对dbf文件的简单读写_第3页
使用java实现对dbf文件的简单读写_第4页
使用java实现对dbf文件的简单读写_第5页
资源描述:

《使用java实现对dbf文件的简单读写》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库

1、使用Java实现对dbf文件的简单读写将dbf文件的读写基本分成四个类,Writer,Reader,Field,Exception,内容如下,如果需要其Doc文档和完整源码包,请发mail至iihero@eyou.com/***

Title:java访问DBF文件的接口

*

Description:这个类用于表示DBF文件中的写操作

*

Copyright:Copyright(c)2004

*

Company:ict

*@author:HeXiong*@version1.0*/packagecom.hexiong.jdbf;importjav

2、a.io.*;importjava.util.Calendar;//Referencedclassesofpackagecom.hexiong.jdbf://JDBFException,JDBFieldpublicclassDBFWriter{publicDBFWriter(Strings,JDBFieldajdbfield[])throwsJDBFException{stream=null;recCount=0;fields=null;fileName=null;dbfEncoding=null;fileName=s;try{init(newFileOutputStream(s)

3、,ajdbfield);}catch(FileNotFoundExceptionfilenotfoundexception){thrownewJDBFException(filenotfoundexception);}}publicDBFWriter(OutputStreamoutputstream,JDBFieldajdbfield[])throwsJDBFException{stream=null;recCount=0;fields=null;fileName=null;dbfEncoding=null;init(outputstream,ajdbfield);}publicD

4、BFWriter(Strings,JDBFieldajdbfield[],Strings1)throwsJDBFException{stream=null;recCount=0;fields=null;fileName=null;dbfEncoding=null;fileName=s;try{dbfEncoding=s1;init(newFileOutputStream(s),ajdbfield);}catch(FileNotFoundExceptionfilenotfoundexception){thrownewJDBFException(filenotfoundexceptio

5、n);}}privatevoidinit(OutputStreamoutputstream,JDBFieldajdbfield[])throwsJDBFException{fields=ajdbfield;try{stream=newBufferedOutputStream(outputstream);writeHeader();for(inti=0;i

6、wnewJDBFException(exception);}}privatevoidwriteHeader()throwsIOException{byteabyte0[]=newbyte[16];abyte0[0]=3;Calendarcalendar=Calendar.getInstance();abyte0[1]=(byte)(calendar.get(1)-1900);abyte0[2]=(byte)calendar.get(2);abyte0[3]=(byte)calendar.get(5);abyte0[4]=0;abyte0[5]=0;abyte0[6]=0;abyte

7、0[7]=0;inti=(fields.length+1)*32+1;abyte0[8]=(byte)(i%256);abyte0[9]=(byte)(i/256);intj=1;for(intk=0;k

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。