1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-06-05 18:10:46 +00:00
plantuml/src/net/sourceforge/plantuml/preproc/ReadLineReader.java
2013-12-11 19:06:45 +01:00

73 lines
2.1 KiB
Java

/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2013, Arnaud Roques
*
* Project Info: http://plantuml.sourceforge.net
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
* in the United States and other countries.]
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 3835 $
*
*/
package net.sourceforge.plantuml.preproc;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.Reader;
public class ReadLineReader implements ReadLine {
private final BufferedReader br;
public ReadLineReader(Reader reader) {
br = new BufferedReader(reader);
}
public String readLine() throws IOException {
String s = br.readLine();
if (s != null && s.startsWith("\uFEFF")) {
s = s.substring(1);
}
if (s != null) {
s = s.replace('\u2013', '-');
s = s.replace('\u00A0', ' ');
s = s.replace('\u201c', '\"');
s = s.replace('\u201d', '\"');
s = s.replace('\u00ab', '\"');
s = s.replace('\u00bb', '\"');
// for (int i = 0; i < s.length(); i++) {
// char c = s.charAt(i);
// System.err.println("X " + Integer.toHexString((int) c) + " " + c);
// }
}
return s;
}
public void close() throws IOException {
br.close();
}
}