Depending on your environment...

I am not sure about Unix but in Windows you would need to create a JNI,
because I don't see a way to do this in 100% pure Java. (There goes your
certification. :-)

You could then use the MS Visual C++ class function of
CFile::SetLength() to reduce the size.

Tim Gallagher



-----Original Message-----
From: Rogerio Meneguelli Gatto [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 12, 1999 10:04 AM
To: [EMAIL PROTECTED]
Subject: Re: how to delete files


Is there a way to truncate a file, say, reduce it's length by x bytes?

[]'s
Rog�rio Gatto

> -----Original Message-----
> From: A mailing list for discussion about Sun Microsystem's
> Java Servlet
> API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of
> Timothy Gallagher
> Sent: Thursday, March 11, 1999 7:50 PM
> To: [EMAIL PROTECTED]
> Subject: Re: how to delete files
>
>
> If you don't have some form of delete indicator for each record, you
> will have copy the file to a temporary file while removing the data.
> Once the temporary file is created and filled, delete the
> original file
> and rename the temporary file.
>
> If you have a space for a delete indicator, I would suggest using a
> RandomAccessFile, seek() to the desired location, and set the
> indicator.
>
> Tim Galllagher
>
> -----Original Message-----
> From: Mario [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, March 11, 1999 5:37 AM
> To: [EMAIL PROTECTED]
> Subject: Re: how to delete files
>
>
> class java.io.File, method delete()
> Check API-documentation.
> Mario
> > hello,
>
> > In the destroy method of my servlet I wanted to delete the
> entries in
> a
> > file.(not useing jdbc.  it is a flat file) can some one help me with
> this.
>
>
>
>
> >   Revathy R.
>
>
> >   Revathy R.
>
> >
> ______________________________________________________________
> __________
> ___
> > To unsubscribe, send email to [EMAIL PROTECTED] and
> include in the
> body
> > of the message "signoff SERVLET-INTEREST".
>
> > Archives:
> http://archives.java.sun.com/archives/servlet-> interest.html
> >
> Resources:
>
http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

________________________________________________________________________
___
To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

________________________________________________________________________
___
To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

________________________________________________________________________
___
To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to