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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T22:12:48+00:00 2026-05-31T22:12:48+00:00

I am printing a chunk from inputstream by using int skip = in.skip(1024); //skip

  • 0

I am printing a chunk from inputstream by using

int skip = in.skip(1024); //skip first 1024b

int end = in.available(); // remaining size in b

for (int i = skip; i < end; i++) {

    //prints chunk of data from in-stream from skip till end

     System.out.println(in.read()); 

} 

instead of printing from skip to end, i want to compress the bytes between skip to end (in.read())
can someone help me to first compress and then decompress the same


i tried this

FileOutputStream fos = new FileOutputStream(ChunkZipName);
GZIPOutputStream chunkZipper = new GZIPOutputStream (fos); 
for (int i = skip; i < end; i++) {
chunkZipper.write(in.read()); }

but it write only 10bytes.. remaining bytes r skipped … is this correct usage of GZIPOutputStream ???

  • 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-31T22:12:49+00:00Added an answer on May 31, 2026 at 10:12 pm

    Just wrap a GZIPOutputStream / GZIPInputStream around your real stream.

    out = new GZIPOutputStream (out);
    

    BTW:
    If you want to really skip exactly 1024 bytes you have to check the return value of skip and repeat with the remaining bytes because in some cases (buffers) the method does not skip fully to the desired position.

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

Sidebar

Related Questions

I just added printing capability to a web site using a style sheet (ie.
I have successfully implemented printing and print preview for my app using the PrintDocument,
Please help me in printing the complete object using console.log method. If I am
What is the recommended way of printing a text document as a pdf using
Problem: Printing from within BIDS 2008 R2 Preview tab hangs and must have the
Using System.Drawing.Printing, I want to print a set of lines on print document. But
When printing to PDF using C# + Excel Interop what is the best practice
When printing floats, ruby prints 1234.0 with only one 0 after the period. How
I'm printing a webpage using the javascript window.print(); whether enclosed in a document.ready or
When printing from WebKit, it seems to automatically impose a shrink factor on 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.