@@ -0,0 +1,1878 @@
+/*%0A * Licensed to the University of California, Berkeley under one or more contributor license%0A * agreements. See the NOTICE file distributed with this work for additional information regarding%0A * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the%0A * %22License%22); you may not use this file except in compliance with the License. You may obtain a%0A * copy of the License at%0A *%0A * http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software distributed under the License%0A * is distributed on an %22AS IS%22 BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express%0A * or implied. See the License for the specific language governing permissions and limitations under%0A * the License.%0A */%0A%0Apackage tachyon.worker.keyvalue;%0A%0Aimport tachyon.util.io.ByteIOUtils;%0A%0Aimport java.io.Closeable;%0Aimport java.io.Flushable;%0Aimport java.io.IOException;%0Aimport java.io.OutputStream;%0A%0A/**%0A * Writer to create key-value payload.%0A */%0Apublic final class PayloadWriter implements Closeable, Flushable %7B%0A  private OutputStream mOutputStream;%0A%0A  public PayloadWriter(OutputStream out) %7B%0A    mOutputStream = out;%0A  %7D%0A%0A  @Override%0A  public void flush() throws IOException %7B%0A    mOutputStream.flush();%0A  %7D%0A%0A  @Override%0A  public void close() throws IOException %7B%0A    mOutputStream.close();%0A  %7D%0A%0A  /**%0A   * Puts a key into payload.%0A   *%0A   * @param key bytes of key%0A   * @param value offset of this key in payload%0A   * @throws IOException if error occurs writing the key and value to output stream%0A   */%0A  public void addKeyAndValue(byte%5B%5D key, byte%5B%5D value) throws IOException %7B%0A    // Pack key and value into a byte array%0A    ByteIOUtils.writeInt(mOutputStream, key.length);%0A    ByteIOUtils.writeInt(mOutputStream, value.length);%0A    mOutputStream.write(key);%0A    mOutputStream.write(value);%0A  %7D%0A%7D%0A

Add intial impl of PayloadWriter