X-Git-Url: http://secure.phpeclipse.com diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/phpdoc/SingleCharReader.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/phpdoc/SingleCharReader.java index 2507032..858cc75 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/phpdoc/SingleCharReader.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/phpdoc/SingleCharReader.java @@ -1,15 +1,20 @@ +/******************************************************************************* + * Copyright (c) 2000, 2003 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ package net.sourceforge.phpdt.internal.corext.phpdoc; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ - import java.io.IOException; import java.io.Reader; public abstract class SingleCharReader extends Reader { - + /** * @see Reader#read() */ @@ -19,9 +24,9 @@ public abstract class SingleCharReader extends Reader { * @see Reader#read(char[],int,int) */ public int read(char cbuf[], int off, int len) throws IOException { - int end= off + len; - for (int i= off; i < end; i++) { - int ch= read(); + int end = off + len; + for (int i = off; i < end; i++) { + int ch = read(); if (ch == -1) { if (i == off) { return -1; @@ -29,27 +34,31 @@ public abstract class SingleCharReader extends Reader { return i - off; } } - cbuf[i]= (char)ch; + cbuf[i] = (char) ch; } return len; - } - + } + /** * @see Reader#ready() - */ - public boolean ready() throws IOException { + */ + public boolean ready() throws IOException { return true; } - + /** * Gets the content as a String */ public String getString() throws IOException { - StringBuffer buf= new StringBuffer(); + StringBuffer buf = new StringBuffer(); int ch; - while ((ch= read()) != -1) { - buf.append((char)ch); + while ((ch = read()) != -1) { + if (ch == '\n' || ch == '\r') { + buf.append("
"); + } else { + buf.append((char) ch); + } } return buf.toString(); } -} \ No newline at end of file +}