Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4004914
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T08:19:52+00:00 2026-05-20T08:19:52+00:00

I could handle the Modified (lastModified) attribute, meaning in the archive I could preserve

  • 0

I could handle the Modified (lastModified) attribute, meaning in the archive I could preserve the Modified attribute of the file.
Here is a sample:

ZipOutputStream out = new ZipOutputStream(new BufferedOutputStream( new FileOutputStream(outFilename)));
File f = new File(filename);
long longLastMod = f.lastModified();
FileInputStream in = new FileInputStream(filename);
// Add ZIP entry to output stream.
ZipEntry ze = new ZipEntry(filename);
ze.setTime(longLastMod);  // the "magic" to store the Modified date/time of the file
out.putNextEntry( ze );
// Transfer bytes from the file to the ZIP file
int len;
while ((len = in.read(buf)) > 0) {
    out.write(buf, 0, len);
}
out.closeEntry();
in.close();
out.close();

Now, the output Zip file will preserve the Modified attribute but it will not preserve the Created or Accessed attributes.
Is there a way to accomplish this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T08:19:52+00:00Added an answer on May 20, 2026 at 8:19 am

    Is there a way to accomplish this?

    No it’s not possible. To put it simply: the zip directory doesn’t support the attributes.

    What you can do, however, is using setExtra(byte[]) and store whatever information you need there. Unfortunately, you’d need a custom extractor to preserve the attributes.

    Hope this helps!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm wondering how I could modified this great example handler found here: https://github.com/netty/netty/blob/master/example/src/main/java/io/netty/example/http/file/HttpStaticFileServerHandler.java To
This I could handle: myArray = [[NSMutableArray alloc] init]; [myArray addObject:@some1]; [myArray addObject:@some2]; I
Is there a flash player that could handle all of the formats mentioned above.
I am trying to create an array or list that could handle in theory,
I want to use a custom class that could handle querying easily. Are there
I usually use ax.set_rasterized(True) to rasterize the figure so that it could handle transparency
How could we handle null for a datetime field (got from SQL Server) in
Could you post a simple code to handle shutdown event. I need manifest and
I have an BroadcastReceiver for handling new or modified applications: <receiver android:name=.PackageHandler > <intent-filter>
I created an FSEvent to handle the file changes. My problem is that the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.