πŸš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #642

Re: Translate a Delphi code to Java code

#642
From: Alexey N. Solofnenko
Date: Tue, 05 Apr 2005 23:52
43 lines
2255 bytes
It is quite simple. You would want to use double quotes, escaped back 
slashes, and java.io.* streams. In order to copy file write something 
like that:

byte[] buffer=new byte[0x20000];
int read;
while ((read=in.read(buffer))>0) {
   out.write(buffer, 0, read);
}

Stream closing should be done with try/finally block.

- Alexey.

Ronaldo wrote:
> Hi all !!!!
> I have the follow Delphi code, and I need rewrite that code in Java, but I donΒ΄t know how do that ... 
> 
> I appreciate your help in advance.
> 
> Ronaldo.
> 
> Delphi code :
> 
> procedure TBackupFile_S3R.DeCompressOldMethod();
> var
>     vls_out : TextFile;
>     vls_in  : TextFile;
>     vls_Texto : String;
> begin
>    vls_Texto := 'c:\temp\';
>    AssignFile(vls_in, vls_Texto + '\inputfile.zip');
>    AssignFile(vls_out, vls_Texto + '\outputfile.txt');
>    ReWrite(vls_out);
>    Reset(vls_in);
>    While NOT EOF(vls_in) Do
>    Begin
>       ReadLn(vls_in, vls_Texto);
>       WriteLn(vls_out, Copy(vls_texto, Pos(#$A#$A#$A, vls_texto) + 3, Length(vls_texto) - Pos(#$A#$A#$A, vls_texto) + 3));
>    End;
>    Close(vls_in);
>    Close(vls_out);
> end ;
Technical Details
Message-ID: <425324d7$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news1.google.com!newsread.com!news-xfer.newsread.com!nntp.abs.net!newsfeed1.swip.net!swipnet!newsfeed1.funet.fi!newsfeeds.funet.fi!uio.no!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
References: <425307fa$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: f74b3,c0306b9cec2e57c1
X-Google-Attributes: gidf74b3,public
X-Google-Language: ENGLISH,UTF8
Date: Tue, 05 Apr 2005 16:52:57 -0700
From: "Alexey N. Solofnenko" <alexeys@inventigo.com>
User-Agent: Mozilla Thunderbird 1.0+ (Windows/20050405)
MIME-Version: 1.0
Newsgroups: borland.public.jbuilder.java.language
Subject: Re: Translate a Delphi code to Java code
References: <425307fa$1@newsgroups.borland.com>
In-Reply-To: <425307fa$1@newsgroups.borland.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
NNTP-Posting-Host: 208.200.221.5
Message-ID: <425324d7$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1112745175 208.200.221.5 (5 Apr 2005 16:52:55 -0800)
Lines: 43
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news1.google.com!newsread.com!news-xfer.newsread.com!nntp.abs.net!newsfeed1.swip.net!swipnet!newsfeed1.funet.fi!newsfeeds.funet.fi!uio.no!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