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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T13:44:08+00:00 2026-06-01T13:44:08+00:00

I have a specific issue with general console printing and I was wondering whether

  • 0

I have a specific issue with general console printing and I was wondering whether anyone has a solution for it. I am trying to print a dataTable which would look like sth like this:

Table
----------------------
Name    |Surname     |
----------------------
Mike    |Mikhailowish|
Rafaello|Mirena      |

and so on. In order to print the border of the bar I need to know what the maximum length of each column value is. I don’t want to go through the whole database to find that out and then again to print it. I would rather like to do sth like:

System.out.printLater(s); //herejust leave a pointer to a StringBuilder you will build
...
s.append("--------");
...
System.out.printAllDeferred();

I understand the above is probably in 99.99999% chances impossible, but perhaps you guys have a clever way of achieving the above?

  • 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-01T13:44:10+00:00Added an answer on June 1, 2026 at 1:44 pm

    You can wrap a PrintStream around a ByteArrayOutputStream and then use that PrintStream instead of System.out (or use System.setOut) to print to it. Later you can print the whole byte array instead.

    But that does not really help you since you’ll have to adjust all columns; better collect all cells from db into an array and calculate max lengths, then print the array.

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

Sidebar

Related Questions

After searching the other questions none have answered the specific issue I have. We
I have seen a few posts regarding this issue but not one specific to
I have a very odd issue. When I execute a specific database stored procedure
I have a specific case in mind, but the question applies in general too.
I have a specific question, that could use a general answer... When building Multi-Tier
This is actually comes from a specific WordPress issue but there's a more general
I have a weird issue (weird because it is specific to one component) with
Let's say I have a large set of data within which each datum has
Consider the following general issue before I go to the specific problem: You use
EDIT: I have added Slug column to address performance issues on specific record selection.

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.