sockets.tcp - redirect to file for Android and iOS

- set `destUri` to non-empty string will open outputStream
- set `destUrl` to empty string will close outputStream
- `close` and `disconnect` will close outputStream
- ~~`readyToRead` is not set to `false` after sending receive event~~ `readToRead` is ignored for redirect to file
- Fixed some style issues from other code reviews
I see. I assumed a call to update without desturi would cancel it.

On Mon, 10 Nov 2014 15:41 Rui Zhao <notifications@github.com> wrote:

> In
> chrome-cordova/plugins/chrome.sockets.tcp/src/android/ChromeSocketsTcp.java:
>
> > @@ -652,6 +683,30 @@ void setProperties(JSONObject properties) throws JSONException, SocketException
> >          bufferSize = properties.getInt("bufferSize");
> >          setBufferSize();
> >        }
> > +
> > +      if (!properties.isNull("append"))
> > +        append = properties.getBoolean("append");
> > +
> > +      if (!properties.isNull("destUri")) {
> > +        try {
> > +          resetDestOutputStream();
> > +
> > +          String uriString = properties.getString("destUri");
> > +
> > +          if (uriString.length() > 0) {
>
> set destUri to "" will cancel redirect to file feature, and start send
> receive event with received data.
>
> Alternatively, we can use a boolean in properties field to indicate
> weather we are redirecting data to file.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/MobileChromeApps/mobile-chrome-apps/pull/416/files#r20110913>
> .
>