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

  • Home
  • SEARCH
  • 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 7580933
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T18:02:49+00:00 2026-05-30T18:02:49+00:00

I’m reading an InputStream to a String using the following code. public String convertStreamToString(InputStream

  • 0

I’m reading an InputStream to a String using the following code.

public String convertStreamToString(InputStream is) {
    try {
        return new Scanner(is).useDelimiter("\\A").next();
    } catch (NoSuchElementException e) {
        return "";
    }
}

However I’m getting a very large String as output. How can I parse it to just get values forFree blocks and Block count as two seperate strings?

03-01 09:28:25.772: I/System.out(8849): tune2fs 1.41.10 (10-Feb-2009)
03-01 09:28:25.772: I/System.out(8849): Filesystem volume name:   <none>
03-01 09:28:25.772: I/System.out(8849): Last mounted on:          <not available>
03-01 09:28:25.772: I/System.out(8849): Filesystem UUID:          c6a5907b-71b3-4686-9ed1-8dd932c6359b
03-01 09:28:25.772: I/System.out(8849): Filesystem magic number:  0xEF53
03-01 09:28:25.772: I/System.out(8849): Filesystem revision #:    1 (dynamic)
03-01 09:28:25.772: I/System.out(8849): Filesystem features:      has_journal ext_attr dir_index filetype sparse_super
03-01 09:28:25.772: I/System.out(8849): Filesystem flags:         unsigned_directory_hash 
03-01 09:28:25.772: I/System.out(8849): Default mount options:    (none)
03-01 09:28:25.772: I/System.out(8849): Filesystem state:         clean
03-01 09:28:25.772: I/System.out(8849): Errors behavior:          Continue
03-01 09:28:25.772: I/System.out(8849): Filesystem OS type:       Linux
03-01 09:28:25.772: I/System.out(8849): Inode count:              24480
03-01 09:28:25.772: I/System.out(8849): Block count:              97656
03-01 09:28:25.772: I/System.out(8849): Reserved block count:     4882
03-01 09:28:25.772: I/System.out(8849): Free blocks:              90433
03-01 09:28:25.772: I/System.out(8849): Free inodes:              24469
03-01 09:28:25.772: I/System.out(8849): First block:              1
03-01 09:28:25.772: I/System.out(8849): Block size:               1024
03-01 09:28:25.772: I/System.out(8849): Fragment size:            1024
03-01 09:28:25.772: I/System.out(8849): Blocks per group:         8192
03-01 09:28:25.772: I/System.out(8849): Fragments per group:      8192
03-01 09:28:25.772: I/System.out(8849): Inodes per group:         2040
03-01 09:28:25.772: I/System.out(8849): Inode blocks per group:   255
03-01 09:28:25.772: I/System.out(8849): Filesystem created:       Thu Mar  1 04:01:37 2012
03-01 09:28:25.772: I/System.out(8849): Last mount time:          n/a
03-01 09:28:25.772: I/System.out(8849): Last write time:          Thu Mar  1 04:01:37 2012
03-01 09:28:25.772: I/System.out(8849): Mount count:              0
03-01 09:28:25.772: I/System.out(8849): Maximum mount count:      35
03-01 09:28:25.772: I/System.out(8849): Last checked:             Thu Mar  1 04:01:37 2012
03-01 09:28:25.772: I/System.out(8849): Check interval:           15552000 (6 months)
03-01 09:28:25.772: I/System.out(8849): Next check after:         Tue Aug 28 04:01:37 2012
03-01 09:28:25.772: I/System.out(8849): Reserved blocks uid:      0 (user root)
03-01 09:28:25.772: I/System.out(8849): Reserved blocks gid:      0 (group root)
03-01 09:28:25.772: I/System.out(8849): First inode:              11
03-01 09:28:25.772: I/System.out(8849): Inode size:           128
03-01 09:28:25.772: I/System.out(8849): Journal inode:            8
03-01 09:28:25.772: I/System.out(8849): Default directory hash:   half_md4
03-01 09:28:25.772: I/System.out(8849): Directory Hash Seed:      fb1c85fc-7de0-431e-be07-aa42bee66e7d
03-01 09:28:25.772: I/System.out(8849): Journal backup:           inode blocks
03-01 09:28:25.819: I/System.out(8849): length = 1512
03-01 09:28:25.819: I/System.out(8849): 2
  • 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-30T18:02:53+00:00Added an answer on May 30, 2026 at 6:02 pm

    [Edited] Sorry didn’t realize what you were doing with your scanner:

        Scanner scanner = new Scanner(is).useDelimiter("\\n");
        scanner.findWithinHorizon(Pattern.compile("Block\\scount:\\s*(\\d+)"), 0);
        String blockCount = scanner.match().group(1);
        scanner.findWithinHorizon(Pattern.compile("Free\\sblocks:\\s*(\\d+)"), 0);
        String freeBlocks = scanner.match().group(1);
    

    That will give you just the values of free blocks and block count. For example, freeBlocks would equal “90433”, and blockCount would equal “97656”.

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

Sidebar

Related Questions

I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
public static bool CheckLogin(string Username, string Password, bool AutoLogin) { bool LoginSuccessful; // Trim
I am reading a book about Javascript and jQuery and using one of the
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text

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.