/*
 * Licensed to the University of California, Berkeley under one or more contributor license
 * agreements. See the NOTICE file distributed with this work for additional information regarding
 * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance with the License. You may obtain a
 * copy of the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software distributed under the License
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing permissions and limitations under
 * the License.
 */

package tachyon.client;

import java.io.IOException;
import java.io.OutputStream;

import tachyon.conf.TachyonConf;

/**
 * <code>OutStream</code> is the base output stream class for TachyonFile streaming output methods.
 * It can only be gotten by calling the methods in <code>tachyon.client.TachyonFile</code>, but can
 * not be initialized by the client code.
 */
public abstract class OutStream extends OutputStream {
  protected final TachyonFile mFile;
  protected final TachyonFS mTachyonFS;
  protected final WriteType mWriteType;
  protected final TachyonConf mTachyonConf;

  /**
   * @param file the output file of the OutStream
   * @param writeType the OutStream's write type
   */
  OutStream(TachyonFile file, WriteType writeType, TachyonConf tachyonConf) {
    mFile = file;
    mTachyonFS = mFile.mTachyonFS;
    mWriteType = writeType;
    mTachyonConf = tachyonConf;
  }

  /**
   * Cancel the write operations to the OutStream
   * 
   * @throws IOException
   */
  public abstract void cancel() throws IOException;

  @Override
  public abstract void close() throws IOException;

  @Override
  public abstract void flush() throws IOException;

  @Override
  public abstract void write(byte[] b) throws IOException;

  @Override
  public abstract void write(byte[] b, int off, int len) throws IOException;

  @Override
  public abstract void write(int b) throws IOException;
}

@@ -413,18 +413,17 @@
 se at%0A *
- 
 %0A
+
  * http:
@@ -462,17 +462,16 @@
 E-2.0%0A *
- 
 %0A * Unle
@@ -945,16 +945,25 @@
 he base 
+class of 
 output s
@@ -968,22 +968,16 @@
  stream 
-class 
 for Tach
@@ -1004,53 +1004,62 @@
 tput
- methods.
+. To
 %0A * 
-I
+ge
 t 
-c
 an 
-only be gotten by
+instance of this class, one should
  call
-ing
  the
@@ -1069,12 +1069,40 @@
 thod
-s in
+ %3Ccode%3EgetOutStream%3C/code%3E of%0A *
  %3Cco
@@ -1143,44 +1143,66 @@
 e%3E, 
-but can%0A * not be initialized by
+rather than constructing a new instance directly in
  the
+%0A *
  cli
@@ -1795,21 +1795,20 @@
 tStream%0A
+
    *
- 
 %0A   * @t

Clarify the class comment of OutStream