blob: e172b4b568a429ae583058bfea8840369199cceb [file] [log] [blame]
/******************************************************************************
* Copyright (c) David Orme 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:
* David Orme - initial API and implementation
******************************************************************************/
package org.eclipse.e4.ui.test.utils;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
/**
* An InputStream that reads from a String.
*/
public class StringInputStream extends InputStream {
private InputStream delegate;
public StringInputStream(String string) {
try {
this.delegate = new ByteArrayInputStream(string.getBytes("ISO-8859-1"));
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
}
@Override
public int read() throws IOException {
return delegate.read();
}
}