diff options
Diffstat (limited to 'examples/org.eclipse.compare.examples/src/org/eclipse/compare/examples/structurecreator/Util.java')
-rw-r--r-- | examples/org.eclipse.compare.examples/src/org/eclipse/compare/examples/structurecreator/Util.java | 66 |
1 files changed, 0 insertions, 66 deletions
diff --git a/examples/org.eclipse.compare.examples/src/org/eclipse/compare/examples/structurecreator/Util.java b/examples/org.eclipse.compare.examples/src/org/eclipse/compare/examples/structurecreator/Util.java deleted file mode 100644 index 04ae99f8a..000000000 --- a/examples/org.eclipse.compare.examples/src/org/eclipse/compare/examples/structurecreator/Util.java +++ /dev/null @@ -1,66 +0,0 @@ -/******************************************************************************* - * 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 org.eclipse.compare.examples.structurecreator; - -import java.io.*; -import java.util.*; - -import org.eclipse.core.resources.ResourcesPlugin; - - -public class Util { - - private static final String RESOURCE_BUNDLE= "org.eclipse.compare.examples.structurecreator.CompareExampleMessages"; //$NON-NLS-1$ - - private static ResourceBundle fgResourceBundle= ResourceBundle.getBundle(RESOURCE_BUNDLE); - - public static String getString(String key) { - try { - return fgResourceBundle.getString(key); - } catch (MissingResourceException e) { - return "!" + key + "!"; //$NON-NLS-2$ //$NON-NLS-1$ - } - } - - /** - * Reads the contents of the given input stream into a string. - * The function assumes that the input stream uses the platform's default encoding - * (<code>ResourcesPlugin.getEncoding()</code>). - * Returns null if an error occurred. - */ - static String readString(InputStream is) { - if (is == null) - return null; - BufferedReader reader= null; - try { - StringBuffer buffer= new StringBuffer(); - char[] part= new char[2048]; - int read= 0; - reader= new BufferedReader(new InputStreamReader(is, ResourcesPlugin.getEncoding())); - - while ((read= reader.read(part)) != -1) - buffer.append(part, 0, read); - - return buffer.toString(); - - } catch (IOException ex) { - } finally { - if (reader != null) { - try { - reader.close(); - } catch (IOException ex) { - // we don't log IOException when closing a file - } - } - } - return null; - } -} |