com.android.repository.testframework
Class MockFileOp.StringOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by java.io.ByteArrayOutputStream
          extended by 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.


Field Summary
 
Fields inherited from class java.io.ByteArrayOutputStream
buf, count
 
Constructor Summary
MockFileOp.StringOutputStream(java.io.File file)
           
 
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
 

Constructor Detail

MockFileOp.StringOutputStream

public MockFileOp.StringOutputStream(java.io.File file)
Method Detail

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