FileDocCategorySizeDatePackage
LogWriter.javaAPI DocAndroid 5.1 API1873Thu Mar 12 22:22:56 GMT 2015android.support.v4.util

LogWriter

public class LogWriter extends Writer
Helper for accessing features in {@link android.util.LogWriter} introduced after API level 4 in a backwards compatible fashion.
hide

Fields Summary
private final String
mTag
private StringBuilder
mBuilder
Constructors Summary
public LogWriter(String tag)
Create a new Writer that sends to the log with the given priority and tag.

param
tag A string tag to associate with each printed log statement.


                                    
       
        mTag = tag;
    
Methods Summary
public voidclose()

        flushBuilder();
    
public voidflush()

        flushBuilder();
    
private voidflushBuilder()

        if (mBuilder.length() > 0) {
            Log.d(mTag, mBuilder.toString());
            mBuilder.delete(0, mBuilder.length());
        }
    
public voidwrite(char[] buf, int offset, int count)

        for(int i = 0; i < count; i++) {
            char c = buf[offset + i];
            if ( c == '\n") {
                flushBuilder();
            }
            else {
                mBuilder.append(c);
            }
        }