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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:30:30+00:00 2026-06-13T10:30:30+00:00

I have an assignment where we need to write a (very simplified) multithreaded compression

  • 0

I have an assignment where we need to write a (very simplified) multithreaded compression program in java (using the built in GzipOutputStream is fine). I understand mostly how to do everything else, but there’s one part of the instructions that specifies that we have to dividing the input stream into 128kB blocks, and each thread will work on compressing one of those blocks.

I think I’m missing something glaringly obvious, but at the moment the only way I can think of to split up the input stream is using the IO InpuStream’s read() command (which reads one byte at a time) and manually counting up to 128 or if we reach the end of the file first. But that seems horribly inefficient.

Another thing, which is somewhat off tangent and I’m still busily googling to try and figure out, is that it says we’re supposed to use the last 32kB of each previous block to prime the compression dictionary for the next block. I vaguely understand what that means, although I’m not entirely sure how to implement it or if it affects how I should treat the input stream byte by byte.

EDIT: To specify, unless I’m thinking of a different dictionary, the deflater class can take in an int that sets the compression level (1 to 9) but… I’m not sure how to get that to correspond to 32kB, unless I have to write a new dictionary altogether. We’re only doing compression, so there’s no need for the inflater class or such.

  • 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-06-13T10:30:31+00:00Added an answer on June 13, 2026 at 10:30 am

    I think I’m missing something glaringly obvious, but at the moment the only way I can think of to split up the input stream is using the IO InpuStream’s read() command (which reads one byte at a time) and manually counting up to 128 or if we reach the end of the file first. But that seems horribly inefficient.

    Yea. That would be a terrible solution.

    You need to either use BufferedInputStream or InputStream.read(byte[], int, int). The File.length() method could also prove useful … if the input is a file.

    Since this is homework, I’ll leave you to work out the details.

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

Sidebar

Related Questions

I have assignment when I need to write simple time server and a client
I need to write a C program (for a school assignment to determine cache
For an assignment I have to write a Tribool class in C# using a
I have an assignment where I need to implement church numerals in SML using
I have a homework assignment where I need to take input from a file
Hi I have a homework assignment where I need to implement an intersection of
Hello is have a question for a school assignment i need to : Read
I have an assignment to create a GUI using MATLAB GUIDE and am having
I have an assignment about fftw and I was trying to write a small
So i need to write a program that merges two sorted lists into a

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.