private void closeWithStatus(int status, String msg) { if (!this.mClosed) { this.mClosed = true; this.mGuard.close(); writeCommStatusAndClose(status, msg); IoUtils.closeQuietly(this.mFd); releaseResources(); } }
public void close() throws IOException { if (this.mWrapped != null) { try { this.mWrapped.close(); } finally { releaseResources(); } } else { closeWithStatus(0, null); } }
public void closeWithError(String msg) throws IOException { if (this.mWrapped != null) { try { this.mWrapped.closeWithError(msg); } finally { releaseResources(); } } else if (msg == null) { throw new IllegalArgumentException("Message must not be null"); } else { closeWithStatus(MODE_WORLD_READABLE, msg); } }
protected void finalize() throws Throwable { if (this.mWrapped != null) { releaseResources(); } if (this.mGuard != null) { this.mGuard.warnIfOpen(); } try { if (!this.mClosed) { closeWithStatus(3, null); } super.finalize(); } catch (Throwable th) { super.finalize(); } }
public void writeToParcel(Parcel out, int flags) { if (this.mWrapped != null) { try { this.mWrapped.writeToParcel(out, flags); } finally { releaseResources(); } } else { out.writeFileDescriptor(this.mFd); if (this.mCommFd != null) { out.writeInt(MODE_WORLD_READABLE); out.writeFileDescriptor(this.mCommFd); } else { out.writeInt(0); } if ((flags & MODE_WORLD_READABLE) != 0 && !this.mClosed) { closeWithStatus(-1, null); } } }