Article View: borland.public.jbuilder.java.api
Article #80Re: Problem reading a file generated by a Delphi application
From: Kevin Dean [TeamB]
Date: Mon, 04 Apr 2005 16:41
Date: Mon, 04 Apr 2005 16:41
54 lines
3776 bytes
3776 bytes
Ronaldo wrote: > > Hi all !! My name is Ronaldo. I4m from Brazil. > Im having a hard time on reading a file generated by a Software > created through Delphi, its not a regular text file, though it is a > file that was generated by a component, which main goal is to > compress any file using a Zlib, and then to save the bytes from that > compressed file as binary fields. That was just a brief introduction > so as you can have an idea of the general issue My real problem is > reading the header and the footer generated by that component (I do > not have any problem in reading and decompressing the data compressed > with Zlib). At that header, there is information, such as backup > title, size of the backup title, total bytes from the original file, > total files in backup, the size in bytes of the path + name of the > file that was compressed, path + name of the file compressed, date & > time of last update on that file, and a signature EC2 or ECS, > where the first one indicates that the content is compressed, and the > second one indicates that is not The component writes some data with > more frequency; if I manage to read those, I think Ill be able of > reading the others. I created a Delphi code very simple in order to > generate that header, and another one, to read it. I did the same in > Java. However, what I generate in Delphi, cannot be read in Java, and > vice versa. Im going to leave here the source codes in Java and > Delphi, in case someone can help me out. Probably somebody already > passed through this issue, or at least knows both languages. > > I appreciate your help in advance, and apologize for the size of this > message. Without going into your code in too much detail, I would guess that the problem you're experiencing is byte order. Delphi is Intel-based and so writes/reads the low byte first; Java is platform-independent and writes/reads the high byte first. I strongly suggest that if you're trying to write code to read a ZIP file that you start with a known good ZIP file, run it through the Delphi and Java readers, and determine which one breaks. Creating a file with one language and reading it with another doesn't tell you which one is at fault; you need the independent arbiter of a known good ZIP file. -- Kevin Dean [TeamB] Dolphin Data Development Ltd. http://www.datadevelopment.com/ NEW WHITEPAPERS Team Development with JBuilder and Borland Enterprise Server Securing Borland Enterprise Server http://www.datadevelopment.com/papers/index.html Please see Borland's newsgroup guidelines at http://info.borland.com/newsgroups/guide.html
Technical Details
Message-ID:
<xn0e0lmi7194rjq005-kdean@www.teamb.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news2.google.com!newsread.com!news-xfer.newsread.com!newspeer.monmouth.com!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<42515016@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 1089d0,e0d9b07a5e544a79
X-Google-Attributes: gid1089d0,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Kevin Dean [TeamB]" <NkOdSePaAnM@datadevelopment.com>
Subject: Re: Problem reading a file generated by a Delphi application
Newsgroups: borland.public.jbuilder.java.api
References: <42515016@newsgroups.borland.com>
Organization: Dolphin Data Development Ltd.
User-Agent: XanaNews/1.17.3.1
X-Face: ":yn4zt^A_dn>6~{YJmu^B\'4w)e:apPM\VC=Dvf&*tASxX9|BYczkFd$xr.$vNSZ[3Uobr
p]c4\+\l){!WQI.$]veP({HLd;CDYH?iN
Message-ID: <xn0e0lmi7194rjq005-kdean@www.teamb.com>
X-Ref: newsgroups.borland.com ~XNS:00000149
NNTP-Posting-Host: 24.57.153.235
Date: 4 Apr 2005 08:41:32 -0800
X-Trace: newsgroups.borland.com 1112629292 24.57.153.235 (4 Apr 2005 08:41:32 -0800)
Lines: 54
X-Authenticated-User: kdean
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news2.google.com!newsread.com!news-xfer.newsread.com!newspeer.monmouth.com!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail