@InterfaceAudience.Public @InterfaceStability.Evolving public enum CreateFlag extends Enum<CreateFlag>
EnumSet.of(CreateFlag.CREATE, CreateFlag.APPEND)
Use the CreateFlag as follows:
- CREATE - to create a file if it does not exist,
else throw FileAlreadyExists.
- APPEND - to append to a file if it exists,
else throw FileNotFoundException.
- OVERWRITE - to truncate a file if it exists,
else throw FileNotFoundException.
- CREATE|APPEND - to create a file if it does not exist,
else append to an existing file.
- CREATE|OVERWRITE - to create a file if it does not exist,
else overwrite an existing file.
- SYNC_BLOCK - to force closed blocks to the disk device.
In addition
Syncable.hsync()
should be called after each write,
if true synchronous behavior is required.
- LAZY_PERSIST - Create the block on transient storage (RAM) if
available.
- APPEND_NEWBLOCK - Append data to a new block instead of end of the last
partial block.
Following combinations are not valid and will result in
HadoopIllegalArgumentException
:
- APPEND|OVERWRITE
- CREATE|APPEND|OVERWRITE
列挙型定数と説明 |
---|
APPEND
Append to a file.
|
CREATE
Create a file.
|
LAZY_PERSIST
Create the block on transient storage (RAM) if available.
|
NEW_BLOCK
Append data to a new block instead of the end of the last partial block.
|
NO_LOCAL_WRITE
Advise that a block replica NOT be written to the local DataNode where
'local' means the same host as the client is being run on.
|
OVERWRITE
Truncate/overwrite a file.
|
SYNC_BLOCK
Force closed blocks to disk.
|
修飾子とタイプ | メソッドと説明 |
---|---|
static void |
validate(EnumSet<CreateFlag> flag)
Validate the CreateFlag and throw exception if it is invalid
|
static void |
validate(Object path,
boolean pathExists,
EnumSet<CreateFlag> flag)
Validate the CreateFlag for create operation
|
static void |
validateForAppend(EnumSet<CreateFlag> flag)
Validate the CreateFlag for the append operation.
|
static CreateFlag |
valueOf(String name)
指定した名前を持つこの型の列挙型定数を返します。
|
static CreateFlag[] |
values()
この列挙型の定数を含む配列を宣言されている順序で返します。
|
public static final CreateFlag CREATE
public static final CreateFlag OVERWRITE
public static final CreateFlag APPEND
public static final CreateFlag SYNC_BLOCK
public static final CreateFlag LAZY_PERSIST
public static final CreateFlag NEW_BLOCK
@InterfaceAudience.LimitedPrivate(value="HBase") public static final CreateFlag NO_LOCAL_WRITE
public static CreateFlag[] values()
for(CreateFlag c: CreateFlag.values()) System.out.println(c);
public static CreateFlag valueOf(String name)
name
- 返される列挙型定数の名前。IllegalArgumentException
- この列挙型に、指定した名前の定数がない場合NullPointerException
- 引数がnullの場合public static void validate(EnumSet<CreateFlag> flag)
flag
- set of CreateFlagHadoopIllegalArgumentException
- if the CreateFlag is invalidpublic static void validate(Object path, boolean pathExists, EnumSet<CreateFlag> flag) throws IOException
path
- Object representing the path; usually String or Path
pathExists
- pass true if the path exists in the file systemflag
- set of CreateFlagIOException
- on errorHadoopIllegalArgumentException
- if the CreateFlag is invalidpublic static void validateForAppend(EnumSet<CreateFlag> flag)
Copyright © 2016 Apache Software Foundation. All rights reserved.