[WIP] [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

```java
Block block = Blocks.createBlock(tachyonFS, blockId, blockCapacityByte);
```

From there, the user can write to it by accessing its `Channel`.

```java
WritableBlockChannel channel = block.write();
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();
  }
}
```
Would it help to put "channel" at the end?
On Sep 11, 2014 8:58 PM, "Jie Huang" <notifications@github.com> wrote:

> In core/src/main/java/tachyon/client/Block.java:
>
> > @@ -0,0 +1,7 @@
> > +package tachyon.client;
> > +
> > +import java.io.IOException;
> > +
> > +interface Block {
> > +  WritableBlockChannel write() throws IOException;
>
> it is a little bit ambiguous to name this function as write(). It seems to
> fetch a channel for the further writing ops, right?
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/amplab/tachyon/pull/427/files#r17462198>.
>