LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   How much big a line of a text file can be? (https://www.linuxquestions.org/questions/programming-9/how-much-big-a-line-of-a-text-file-can-be-545874/)

manolakis 04-13-2007 05:20 PM

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

theNbomr 04-13-2007 06:01 PM

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.

cfaj 04-13-2007 06:55 PM

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.


schneidz 04-15-2007 01:44 AM

fyi: my aix machine gets mad when i try to open a file in vi with more than 2048 chars per line.

cfaj 04-15-2007 01:55 AM

You wouldn't have that problem with emacs!

jschiwal 04-15-2007 01:56 AM

Look at "getconf LINE_MAX".

schneidz 04-16-2007 01:20 PM

this is weird:
Code:

schneidz@aix-lq> emacs
ksh: emacs:  not found.

also:
Code:

schneidz@aix-lq> getconf LINE_MAX
2048


cfaj 04-16-2007 01:36 PM

Quote:

Originally Posted by schneidz
this is weird:
Code:

schneidz@aix-lq> emacs
ksh: emacs:  not found.



Then you have to install it.


schneidz 04-17-2007 04:04 PM

unfortunately, it's not my computer.

i work in a large corporation and they don't allow much open software.

jlliagre 04-18-2007 12:35 AM

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).


All times are GMT -5. The time now is 07:08 PM.