[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();
  }
}
```
You mean a name change or something else?
On Sep 11, 2014 8:53 PM, "Jie Huang" <notifications@github.com> wrote:

> In core/src/main/java/tachyon/client/Blocks.java:
>
> > @@ -0,0 +1,17 @@
> > +package tachyon.client;
> > +
> > +import java.io.IOException;
> > +
> > +final class Blocks {
> > +  private Blocks() {
> > +
> > +  }
> > +
> > +  public static Block createBlock(TachyonFS tachyonFS, long currentBlockId, long maxBlockSize)
>
> I wonder if it is possible to make this function inside of Block class.
> For example
> Block block = Block.newBlock(...)
> Any specific concern there?
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/amplab/tachyon/pull/427/files#r17462098>.
>