LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-13-2007, 05:20 PM   #1
manolakis
Member
 
Registered: Nov 2006
Distribution: xubuntu
Posts: 464

Rep: Reputation: 37
How much big a line of a text file can be?


Hi there
I want to write to a text file in Java but lets say that I want each line of that text file being really big.(ex 100000 characters)
I just want to ask if there is any restriction of doing that.

Thanks
 
Old 04-13-2007, 06:01 PM   #2
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
The file doesn't know or care what the bytes in it represent. Only the applications that read it will be influenced by it's format. As long as the overall file size falls within the limits for the filesystem type, it makes no difference.
--- rod.
 
Old 04-13-2007, 06:55 PM   #3
cfaj
Member
 
Registered: Dec 2003
Location: Toronto, Canada
Distribution: Mint, Mandriva
Posts: 221

Rep: Reputation: 31
Quote:
Originally Posted by manolakis
Hi there
I want to write to a text file in Java but lets say that I want each line of that text file being really big.(ex 100000 characters)
I just want to ask if there is any restriction of doing that.

For a portable text file (according to the Single Unix Specification) the maximum length of a line system specific and is defined as LINE_MAX in a header file (check /usr/include/).

On some systems the utilities have hard limits on the line length, but the GNU versions are limited only by available memory.

 
Old 04-15-2007, 01:44 AM   #4
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
fyi: my aix machine gets mad when i try to open a file in vi with more than 2048 chars per line.
 
Old 04-15-2007, 01:55 AM   #5
cfaj
Member
 
Registered: Dec 2003
Location: Toronto, Canada
Distribution: Mint, Mandriva
Posts: 221

Rep: Reputation: 31
You wouldn't have that problem with emacs!
 
Old 04-15-2007, 01:56 AM   #6
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
Look at "getconf LINE_MAX".
 
Old 04-16-2007, 01:20 PM   #7
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
this is weird:
Code:
schneidz@aix-lq> emacs
ksh: emacs:  not found.
also:
Code:
schneidz@aix-lq> getconf LINE_MAX
2048

Last edited by schneidz; 04-16-2007 at 01:27 PM.
 
Old 04-16-2007, 01:36 PM   #8
cfaj
Member
 
Registered: Dec 2003
Location: Toronto, Canada
Distribution: Mint, Mandriva
Posts: 221

Rep: Reputation: 31
Quote:
Originally Posted by schneidz
this is weird:
Code:
schneidz@aix-lq> emacs
ksh: emacs:  not found.

Then you have to install it.

 
Old 04-17-2007, 04:04 PM   #9
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
unfortunately, it's not my computer.

i work in a large corporation and they don't allow much open software.
 
Old 04-18-2007, 12:35 AM   #10
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
Java has no restriction on a line length, outside the fact the line has to fit in the available memory.

You may need to increase the maximum memory allocatable by the JVM with the -Xmx option (eg. "java -Xmx1024m" for 1 GB heap).
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
C++ text file line by line/each line to string/array Dimitris Programming 15 03-11-2008 08:22 AM
delete a line containing a pattern and the next line of a text file powah Programming 3 01-31-2007 05:34 PM
read line by line form text file in java. spank Programming 1 10-18-2006 02:46 PM
how to change some text of a certain line of a text file with bash and *nix scripting alred Programming 6 07-10-2006 11:55 AM
SED - display text on specific line of text file 3saul Linux - Software 3 12-29-2005 04:32 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:19 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration