Solved

CR or LF in readLine

Posted on 2000-04-14
4
862 Views
Last Modified: 2008-02-01
is it possible to define exactly which char should end a line ?

i have a file in codepage 500 (EBCDIC) in this codepage 0D0A should be newline. but BufferedReader.readLine()wrongly uses a single 0A as delimeter aswell...

thanx
0
Comment
Question by:marss
  • 2
4 Comments
 
LVL 3

Expert Comment

by:ovidiucraciun
ID: 2715650
you can avoid readline if it doesn't work like you wish.
store all chars in a StringTokenizer and let the default delimiters tab,/r,/n
0
 
LVL 4

Accepted Solution

by:
kylar earned 50 total points
ID: 2716913
A StringTokenizer breaks on \r (carriage return) or \n (newline) (or a tab)  but so does the readln() method of BufferedReader. BufferedReader also looks for a \r\n at the end (return followed immediately by a newline) what you probably want to do is extend BufferedReader then override the readln() and readln(boolean b) methods, then force it to look only for a 0D0A instead of looking for single instances of 0A or 0D.

Kylar


0
 
LVL 3

Expert Comment

by:ovidiucraciun
ID: 2718798
If you set the delimiter as "\r\n"
or "\n\r" (depending of how is oerdered in your case) the StringTokenizer will
break from line to line.
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 2722567
Is this any help:

System.getProperty("line.separator")

Michel
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
MySQL  on Tomcat 8 70
runtime exception 2 42
eclipse console opening separately 2 29
Need help aligning JRadioButton that put in a box using GridBagLayout 2 19
For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question