Giter Club home page Giter Club logo

Comments (3)

fazunenko avatar fazunenko commented on July 28, 2024

I think, the way you upload files is the right way.
Because instances of Blob and BlobInfo classes are immutable objects, you cannot modify Crc32 value of an existing object. So, to enable data validation you need to provide CRC32hash before you open a WriteChannel. The hash calculated after WriteChannel is opened can't be used for validation.

To speed up crc32 hash calculating for your local files I would recommend you to increase the buffer size. 1k seems to be very small size. On my local machine resizing from 1k to 128k reduced hash calculation time from 50 seconds to 4. With the buffer of 1M size calculation took 3 seconds. Experimenting with the size will allow you to figure out the most optimal value.

I hope my answer will help.
Thanks

from java-storage.

fazunenko avatar fazunenko commented on July 28, 2024

I also noticed a bug in your code of CRC calculation:

Instead of:
hasher = hasher.putBytes(ByteBuffer.wrap(buffer, 0, limit-1));

should be:
hasher = hasher.putBytes(ByteBuffer.wrap(buffer, 0, limit));

Otherwise, the last byte in each chunk will be ignored.

from java-storage.

dmitry-fa avatar dmitry-fa commented on July 28, 2024

@Tiozi I hope the question is answered, if you need more details please provide more info.

from java-storage.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.