[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();
  }
}
```
No. Let's not worry about that now. We should proto type if it helps and at
that point verify if it works
On Nov 15, 2014 11:37 PM, "Haoyuan Li" <notifications@github.com> wrote:

> In core/src/main/java/tachyon/client/FileOutStream.java:
>
> > @@ -200,33 +179,16 @@ public void write(byte[] b, int off, int len) throws IOException {
> >      }
> >
> >      if (mWriteType.isThrough()) {
> > -      mCheckpointOutputStream.write(b, off, len);
> > +      buffer.position(pos);
> > +      mCheckpointOutputStream.write(buffer.array(), pos, buffer.limit());
>
> @dcapwell <https://github.com/dcapwell>
>
> "Current patch doesn't support direct but it should before going in."
>
> Does this support direct buffer now?
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/amplab/tachyon/pull/427/files#r20407710>.
>