com.android.repository.testframework
Class MockFileOp.StringOutputStream
java.lang.Object
java.io.OutputStream
java.io.ByteArrayOutputStream
com.android.repository.testframework.MockFileOp.StringOutputStream
- All Implemented Interfaces:
- java.io.Closeable, java.io.Flushable
- Enclosing class:
- MockFileOp
public class MockFileOp.StringOutputStream
- extends java.io.ByteArrayOutputStream
An OutputStream that will capture the stream as an UTF-8 string once properly closed
and associate it to the given File.
| Fields inherited from class java.io.ByteArrayOutputStream |
buf, count |
|
Method Summary |
void |
close()
Once the stream is properly closed, convert the byte array to an UTF-8 string |
java.lang.String |
getData()
Can be null if the stream has never been properly closed. |
java.io.File |
getFile()
|
java.lang.String |
toString()
Returns a string representation suitable for unit tests validation. |
| Methods inherited from class java.io.ByteArrayOutputStream |
reset, size, toByteArray, toString, toString, write, write, writeTo |
| Methods inherited from class java.io.OutputStream |
flush, write |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
MockFileOp.StringOutputStream
public MockFileOp.StringOutputStream(java.io.File file)
getFile
public java.io.File getFile()
getData
public java.lang.String getData()
- Can be null if the stream has never been properly closed.
close
public void close()
throws java.io.IOException
- Once the stream is properly closed, convert the byte array to an UTF-8 string
- Specified by:
close in interface java.io.Closeable- Overrides:
close in class java.io.ByteArrayOutputStream
- Throws:
java.io.IOException
toString
public java.lang.String toString()
- Returns a string representation suitable for unit tests validation.
- Overrides:
toString in class java.io.ByteArrayOutputStream