[TACHYON-152] Client write refactor

Rewriting how client writes out blocks to make it easier to add remote blocks.

The current design is as follows:

Users requests access to a block for writing.

```java
WritableBlockChannel channel = Blocks.createWritableBlock(tachyonFS, blockId, blockCapacityByte);
channel.write(byteBuffer);
channel.close();
```

When the block is full, write returns -1, so you do this in a loop and create new blocks.

```java
while (buffer.remaining() > 0) {
  int n = mCurrentBlockChannel.write(buffer);
  if (n <= 0) {
    // block full, get new block
    getNextBlock();
  }
}
```
This is guava naming convention.
On Sep 19, 2014 11:21 AM, "Henry Saputra" <notifications@github.com> wrote:

> In core/src/main/java/tachyon/client/ForwardingWritableBlockChannel.java:
>
> > @@ -0,0 +1,45 @@
> > +package tachyon.client;
> > +
> > +import java.io.IOException;
> > +import java.nio.ByteBuffer;
> > +
> > +/**
> > + * Forwards all {@link tachyon.client.WritableBlockChannel} operations to the {@link #delegate()}.
> > + * This class does no real work, but is meant to help decorating channels that need some or most
> > + * operations to delegate to another channel.
> > + *
> > + * @param <T> type of the channel, if non given will fall back to
> > + *        {@link tachyon.client.WritableBlockChannel}
> > + */
> > +abstract class ForwardingWritableBlockChannel<T extends WritableBlockChannel> implements
>
> This is actually act like Decorator for underlying write channel, so
> either we name it as Decorator or change to Delegate.
>
> Mixing "Forward" and "Delegate" could be confusing.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/amplab/tachyon/pull/427/files#r17800315>.
>