package tachyon.client;

import tachyon.client.file.options.InStreamOptions;
import tachyon.client.file.options.OutStreamOptions;
import tachyon.conf.TachyonConf;
import tachyon.util.network.NetworkAddressUtils;

public class StreamOptionUtils {
  private StreamOptionUtils() {
    // not intended for instantiation
  }

  public static OutStreamOptions getOutStreamOptionsWriteBoth(TachyonConf conf) {
    return new OutStreamOptions.Builder(conf).setTachyonStorageType(TachyonStorageType.STORE)
               .setUnderStorageType(UnderStorageType.SYNC_PERSIST).build();
  }

  public static OutStreamOptions getOutStreamOptionsWriteTachyon(TachyonConf conf) {
    return new OutStreamOptions.Builder(conf).setTachyonStorageType(TachyonStorageType.STORE)
               .setUnderStorageType(UnderStorageType.NO_PERSIST).build();
  }

  public static OutStreamOptions getOutStreamOptionsWriteUnderStore(TachyonConf conf) {
    return new OutStreamOptions.Builder(conf).setTachyonStorageType(TachyonStorageType.NO_STORE)
               .setUnderStorageType(UnderStorageType.SYNC_PERSIST).build();
  }

  public static OutStreamOptions getOutStreamOptionsWriteLocal(TachyonConf conf) {
    return new OutStreamOptions.Builder(conf).setTachyonStorageType(TachyonStorageType.STORE)
               .setUnderStorageType(UnderStorageType.SYNC_PERSIST)
               .setHostname(NetworkAddressUtils.getLocalHostName(conf)).build();
  }

  public static InStreamOptions getInStreamOptionsReadCache(TachyonConf conf) {
    return new InStreamOptions.Builder(conf).setTachyonStorageType(TachyonStorageType.STORE)
        .build();
  }

  public static InStreamOptions getInStreamOptionsReadNoCache(TachyonConf conf) {
    return new InStreamOptions.Builder(conf).setTachyonStorageType(TachyonStorageType.NO_STORE)
        .build();
  }

}

@@ -1,8 +1,801 @@
+/*%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%0A
 package 
@@ -999,16 +999,90 @@
 Utils;%0A%0A
+/**%0A * A util class to obtain common In/OutStreamOptions for tests%0A *%0A */%0A
 public c
@@ -1177,24 +1177,148 @@
 iation%0A  %7D%0A%0A
+  /**%0A   * Gets WriteBoth OutStreamOptions%0A   *%0A   * @param conf the Tachyon config%0A   * @return the OutStreamOptions%0A   */%0A
   public sta
@@ -1554,32 +1554,159 @@
 ).build();%0A  %7D%0A%0A
+  /**%0A   * Gets WriteTachyon OutStreamOptions%0A   *%0A   * @param conf the Tachyon config%0A   * @return the OutStreamOptions%0A   */%0A
   public static 
@@ -1939,32 +1939,162 @@
 ).build();%0A  %7D%0A%0A
+  /**%0A   * Gets WriteUnderStore OutStreamOptions%0A   *%0A   * @param conf the Tachyon config%0A   * @return the OutStreamOptions%0A   */%0A
   public static 
@@ -2335,32 +2335,157 @@
 ).build();%0A  %7D%0A%0A
+  /**%0A   * Gets WriteLocal OutStreamOptions%0A   *%0A   * @param conf the Tachyon config%0A   * @return the OutStreamOptions%0A   */%0A
   public static 
@@ -2790,32 +2790,154 @@
 ).build();%0A  %7D%0A%0A
+  /**%0A   * Gets ReadCache InStreamOptions%0A   *%0A   * @param conf the Tachyon config%0A   * @return the InStreamOptions%0A   */%0A
   public static 
@@ -3116,16 +3116,140 @@
 );%0A  %7D%0A%0A
+  /**%0A   * Gets ReadNoCache InStreamOptions%0A   *%0A   * @param conf the Tachyon config%0A   * @return the InStreamOptions%0A   */%0A
   public

add license header and java docs