Mercurial > projects > dwt-addons
view dwtx/jface/internal/text/html/SingleCharReader.d @ 131:c4fb132a086c
Add package imports
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sun, 24 Aug 2008 01:13:23 +0200 |
parents | eb30df5ca28b |
children | 51e6e63f930e |
line wrap: on
line source
/******************************************************************************* * Copyright (c) 2000, 2006 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation * Port to the D programming language: * Frank Benoit <benoit@tionex.de> *******************************************************************************/ module dwtx.jface.internal.text.html.SingleCharReader; import dwtx.jface.internal.text.html.HTML2TextReader; // packageimport import dwtx.jface.internal.text.html.HTMLPrinter; // packageimport import dwtx.jface.internal.text.html.BrowserInformationControl; // packageimport import dwtx.jface.internal.text.html.SubstitutionTextReader; // packageimport import dwtx.jface.internal.text.html.HTMLTextPresenter; // packageimport import dwtx.jface.internal.text.html.BrowserInput; // packageimport import dwtx.jface.internal.text.html.BrowserInformationControlInput; // packageimport import dwtx.jface.internal.text.html.HTMLMessages; // packageimport import dwt.dwthelper.utils; import java.io.IOException; import java.io.Reader; /** * <p> * Moved into this package from <code>dwtx.jface.internal.text.revisions</code>.</p> */ public abstract class SingleCharReader : Reader { /** * @see Reader#read() */ public abstract int read() throws IOException; /** * @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(); if (ch is -1) { if (i is off) return -1; return i - off; } cbuf[i]= (char)ch; } return len; } /** * @see Reader#ready() */ public bool ready() throws IOException { return true; } /** * Returns the readable content as string. * @return the readable content as string * @exception IOException in case reading fails */ public String getString() throws IOException { StringBuffer buf= new StringBuffer(); int ch; while ((ch= read()) !is -1) { buf.append((char)ch); } return buf.toString(); } }