Class BinarySafeStream


public final class BinarySafeStream extends Object
Tunnels byte stream into another byte stream so that binary data can be sent across binary-unsafe stream.

This implementation uses a variation of base64. A care has been taken to ensure that the following scenario is handled correctly.

  1. If the writing side flush, the reading side should see everything written by then, without blocking (even if this happens outside the 3-byte boundary)
  2. Reading side won't block unnecessarily.
Kohsuke Kawaguchi