Loading core/java/com/android/internal/util/FastPrintWriter.java +38 −13 Original line number Original line Diff line number Diff line package com.android.internal.util; package com.android.internal.util; import android.util.Log; import android.util.Printer; import android.util.Printer; import java.io.IOException; import java.io.IOException; Loading Loading @@ -328,6 +329,7 @@ public class FastPrintWriter extends PrintWriter { } } private void flushBytesLocked() throws IOException { private void flushBytesLocked() throws IOException { if (!mIoError) { int position; int position; if ((position = mBytes.position()) > 0) { if ((position = mBytes.position()) > 0) { mBytes.flip(); mBytes.flip(); Loading @@ -335,6 +337,7 @@ public class FastPrintWriter extends PrintWriter { mBytes.clear(); mBytes.clear(); } } } } } private void flushLocked() throws IOException { private void flushLocked() throws IOException { //Log.i("PackageManager", "flush mPos=" + mPos); //Log.i("PackageManager", "flush mPos=" + mPos); Loading @@ -352,11 +355,15 @@ public class FastPrintWriter extends PrintWriter { } } break; break; } } if (!mIoError) { flushBytesLocked(); flushBytesLocked(); mOutputStream.flush(); mOutputStream.flush(); } } else if (mWriter != null) { } else if (mWriter != null) { if (!mIoError) { mWriter.write(mText, 0, mPos); mWriter.write(mText, 0, mPos); mWriter.flush(); mWriter.flush(); } } else { } else { int nonEolOff = 0; int nonEolOff = 0; final int sepLen = mSeparator.length(); final int sepLen = mSeparator.length(); Loading Loading @@ -385,12 +392,15 @@ public class FastPrintWriter extends PrintWriter { synchronized (lock) { synchronized (lock) { try { try { flushLocked(); flushLocked(); if (!mIoError) { if (mOutputStream != null) { if (mOutputStream != null) { mOutputStream.flush(); mOutputStream.flush(); } else if (mWriter != null) { } else if (mWriter != null) { mWriter.flush(); mWriter.flush(); } } } } catch (IOException e) { } catch (IOException e) { Log.w("FastPrintWriter", "Write failure", e); setError(); setError(); } } } } Loading @@ -407,6 +417,7 @@ public class FastPrintWriter extends PrintWriter { mWriter.close(); mWriter.close(); } } } catch (IOException e) { } catch (IOException e) { Log.w("FastPrintWriter", "Write failure", e); setError(); setError(); } } } } Loading @@ -425,6 +436,8 @@ public class FastPrintWriter extends PrintWriter { try { try { appendLocked(charArray, 0, charArray.length); appendLocked(charArray, 0, charArray.length); } catch (IOException e) { } catch (IOException e) { Log.w("FastPrintWriter", "Write failure", e); setError(); } } } } } } Loading @@ -442,6 +455,8 @@ public class FastPrintWriter extends PrintWriter { try { try { appendLocked(ch); appendLocked(ch); } catch (IOException e) { } catch (IOException e) { Log.w("FastPrintWriter", "Write failure", e); setError(); } } } } } } Loading @@ -465,6 +480,7 @@ public class FastPrintWriter extends PrintWriter { try { try { appendLocked(str, 0, str.length()); appendLocked(str, 0, str.length()); } catch (IOException e) { } catch (IOException e) { Log.w("FastPrintWriter", "Write failure", e); setError(); setError(); } } } } Loading Loading @@ -500,6 +516,7 @@ public class FastPrintWriter extends PrintWriter { flushLocked(); flushLocked(); } } } catch (IOException e) { } catch (IOException e) { Log.w("FastPrintWriter", "Write failure", e); setError(); setError(); } } } } Loading Loading @@ -564,6 +581,8 @@ public class FastPrintWriter extends PrintWriter { try { try { appendLocked(buf, offset, count); appendLocked(buf, offset, count); } catch (IOException e) { } catch (IOException e) { Log.w("FastPrintWriter", "Write failure", e); setError(); } } } } } } Loading @@ -584,6 +603,8 @@ public class FastPrintWriter extends PrintWriter { try { try { appendLocked((char) oneChar); appendLocked((char) oneChar); } catch (IOException e) { } catch (IOException e) { Log.w("FastPrintWriter", "Write failure", e); setError(); } } } } } } Loading @@ -600,6 +621,8 @@ public class FastPrintWriter extends PrintWriter { try { try { appendLocked(str, 0, str.length()); appendLocked(str, 0, str.length()); } catch (IOException e) { } catch (IOException e) { Log.w("FastPrintWriter", "Write failure", e); setError(); } } } } } } Loading @@ -624,6 +647,8 @@ public class FastPrintWriter extends PrintWriter { try { try { appendLocked(str, offset, count); appendLocked(str, offset, count); } catch (IOException e) { } catch (IOException e) { Log.w("FastPrintWriter", "Write failure", e); setError(); } } } } } } Loading Loading
core/java/com/android/internal/util/FastPrintWriter.java +38 −13 Original line number Original line Diff line number Diff line package com.android.internal.util; package com.android.internal.util; import android.util.Log; import android.util.Printer; import android.util.Printer; import java.io.IOException; import java.io.IOException; Loading Loading @@ -328,6 +329,7 @@ public class FastPrintWriter extends PrintWriter { } } private void flushBytesLocked() throws IOException { private void flushBytesLocked() throws IOException { if (!mIoError) { int position; int position; if ((position = mBytes.position()) > 0) { if ((position = mBytes.position()) > 0) { mBytes.flip(); mBytes.flip(); Loading @@ -335,6 +337,7 @@ public class FastPrintWriter extends PrintWriter { mBytes.clear(); mBytes.clear(); } } } } } private void flushLocked() throws IOException { private void flushLocked() throws IOException { //Log.i("PackageManager", "flush mPos=" + mPos); //Log.i("PackageManager", "flush mPos=" + mPos); Loading @@ -352,11 +355,15 @@ public class FastPrintWriter extends PrintWriter { } } break; break; } } if (!mIoError) { flushBytesLocked(); flushBytesLocked(); mOutputStream.flush(); mOutputStream.flush(); } } else if (mWriter != null) { } else if (mWriter != null) { if (!mIoError) { mWriter.write(mText, 0, mPos); mWriter.write(mText, 0, mPos); mWriter.flush(); mWriter.flush(); } } else { } else { int nonEolOff = 0; int nonEolOff = 0; final int sepLen = mSeparator.length(); final int sepLen = mSeparator.length(); Loading Loading @@ -385,12 +392,15 @@ public class FastPrintWriter extends PrintWriter { synchronized (lock) { synchronized (lock) { try { try { flushLocked(); flushLocked(); if (!mIoError) { if (mOutputStream != null) { if (mOutputStream != null) { mOutputStream.flush(); mOutputStream.flush(); } else if (mWriter != null) { } else if (mWriter != null) { mWriter.flush(); mWriter.flush(); } } } } catch (IOException e) { } catch (IOException e) { Log.w("FastPrintWriter", "Write failure", e); setError(); setError(); } } } } Loading @@ -407,6 +417,7 @@ public class FastPrintWriter extends PrintWriter { mWriter.close(); mWriter.close(); } } } catch (IOException e) { } catch (IOException e) { Log.w("FastPrintWriter", "Write failure", e); setError(); setError(); } } } } Loading @@ -425,6 +436,8 @@ public class FastPrintWriter extends PrintWriter { try { try { appendLocked(charArray, 0, charArray.length); appendLocked(charArray, 0, charArray.length); } catch (IOException e) { } catch (IOException e) { Log.w("FastPrintWriter", "Write failure", e); setError(); } } } } } } Loading @@ -442,6 +455,8 @@ public class FastPrintWriter extends PrintWriter { try { try { appendLocked(ch); appendLocked(ch); } catch (IOException e) { } catch (IOException e) { Log.w("FastPrintWriter", "Write failure", e); setError(); } } } } } } Loading @@ -465,6 +480,7 @@ public class FastPrintWriter extends PrintWriter { try { try { appendLocked(str, 0, str.length()); appendLocked(str, 0, str.length()); } catch (IOException e) { } catch (IOException e) { Log.w("FastPrintWriter", "Write failure", e); setError(); setError(); } } } } Loading Loading @@ -500,6 +516,7 @@ public class FastPrintWriter extends PrintWriter { flushLocked(); flushLocked(); } } } catch (IOException e) { } catch (IOException e) { Log.w("FastPrintWriter", "Write failure", e); setError(); setError(); } } } } Loading Loading @@ -564,6 +581,8 @@ public class FastPrintWriter extends PrintWriter { try { try { appendLocked(buf, offset, count); appendLocked(buf, offset, count); } catch (IOException e) { } catch (IOException e) { Log.w("FastPrintWriter", "Write failure", e); setError(); } } } } } } Loading @@ -584,6 +603,8 @@ public class FastPrintWriter extends PrintWriter { try { try { appendLocked((char) oneChar); appendLocked((char) oneChar); } catch (IOException e) { } catch (IOException e) { Log.w("FastPrintWriter", "Write failure", e); setError(); } } } } } } Loading @@ -600,6 +621,8 @@ public class FastPrintWriter extends PrintWriter { try { try { appendLocked(str, 0, str.length()); appendLocked(str, 0, str.length()); } catch (IOException e) { } catch (IOException e) { Log.w("FastPrintWriter", "Write failure", e); setError(); } } } } } } Loading @@ -624,6 +647,8 @@ public class FastPrintWriter extends PrintWriter { try { try { appendLocked(str, offset, count); appendLocked(str, offset, count); } catch (IOException e) { } catch (IOException e) { Log.w("FastPrintWriter", "Write failure", e); setError(); } } } } } } Loading