FileDocCategorySizeDatePackage
StreamHelper.javaAPI DocAndroid 1.5 API2028Wed May 06 22:41:10 BST 2009com.android.ide.eclipse.common

StreamHelper

public class StreamHelper extends Object
Stream helper class.

Fields Summary
Constructors Summary
Methods Summary
public static java.lang.StringgetMessageTag(java.lang.String tag)
Creates a string containing the current date/time, and the tag

param
tag The tag associated to the message. Can be null
return
The dateTag

        Calendar c = Calendar.getInstance();

        if (tag == null) {
            return String.format(Messages.Console_Date_Tag, c);
        }

        return String.format(Messages.Console_Data_Project_Tag, c, tag);
    
public static synchronized voidprintToStream(org.eclipse.ui.console.MessageConsoleStream stream, java.lang.String tag, java.lang.Object objects)
Prints messages, associated with a project to the specified stream

param
stream The stream to write to
param
tag The tag associated to the message. Can be null
param
objects The objects to print through their toString() method (or directly for {@link String} objects.

        String dateTag = getMessageTag(tag);

        for (Object obj : objects) {
            stream.print(dateTag);
            if (obj instanceof String) {
                stream.println((String)obj);
            } else {
                stream.println(obj.toString());
            }
        }