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 6158615
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T20:59:16+00:00 2026-05-23T20:59:16+00:00

I am develop a web app (using Java EE 6 with GF 3.1) that

  • 0

I am develop a web app (using Java EE 6 with GF 3.1) that allow user to upload a pdf file. Since this is a closed small community, there are lots of chances that the uploaded file is already in the system. I cant just check name for duplication since it is clearly not enough. I was thinking about hash the entire file and store the entry inside a database. Is this feasible and how to achieve this? If not, then what is a better way.

  • 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-23T20:59:16+00:00Added an answer on May 23, 2026 at 8:59 pm

    Consider using checksum.

    This is from http://www.exampledepot.com/egs/java.util.zip/CalculateChecksum.html

    byte[] bytes = "some data".getBytes();
    
    // Compute Adler-32 checksum
    Checksum checksumEngine = new Adler32();
    checksumEngine.update(bytes, 0, bytes.length);
    long checksum = checksumEngine.getValue();
    
    // Compute CRC-32 checksum
    checksumEngine = new CRC32();
    checksumEngine.update(bytes, 0, bytes.length);
    checksum = checksumEngine.getValue();
    
    // The checksum engine can be reused again for a different byte array by calling reset()
    checksumEngine.reset();
    

    Edit:

    Be aware that checksums cannot absolutely tell you if two files are different, but they’re very useful.

    If two files are the same, they will have the same checksum.

    So if the checksums differ, you know absolutely that the files differ.

    But two different files can also sometimes have the same checksum.

    So the way to use this is to calculate the checksums first – if they differ, the files are different. If they’re the same, you’ll have to do a byte-by-byte comparison. That’s slower, of course, but it won’t happen often.

    Note also all of this applies to hashcodes as well.

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

Sidebar

Related Questions

I have a Java web app that I develop on a Windows machine and
I'm using Eclipse to develop a java web app and My IT department called
I am using VB.Net and VS 2008 to develop my web app (that was
I am looking to develop a web-app that displays an image to the user
We are about to develop a web app from scratch using ASP.Net, and would
I'm using seam to develop a simple web app. Using a4j commandButton in many
I want to develop some web apps using Google app engine. I had deployed
I was wondering if I can develop a Desktop App for LinkedIn using Java.
I am using .net mvc 3 to develop web app. Currently I got a
I'm using VS2010/C# to develop my asp.net web app (a web telemetry site), my

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.