@InterfaceAudience.Public @InterfaceStability.Evolving public enum CreateFlag extends Enum<CreateFlag>
EnumSet.of(CreateFlag.CREATE, CreateFlag.APPEND)
Use the CreateFlag as follows:
Syncable.hsync()
should be called after each write,
if true synchronous behavior is required.HadoopIllegalArgumentException
:
Enum Constant and Description |
---|
APPEND
Append to a file.
|
CREATE
Create a file.
|
IGNORE_CLIENT_LOCALITY
Advise that the first block replica NOT take into account DataNode
locality.
|
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_RACK
Advise that a block replica NOT be written to the local rack DataNode where
'local' means the same rack as the client is being run on.
|
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.
|
SHOULD_REPLICATE
Enforce the file to be a replicated file, no matter what its parent
directory's replication or erasure coding policy is.
|
SYNC_BLOCK
Force closed blocks to disk.
|
Modifier and Type | Method and Description |
---|---|
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)
Returns the enum constant of this type with the specified name.
|
static CreateFlag[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
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 final CreateFlag SHOULD_REPLICATE
public static final CreateFlag IGNORE_CLIENT_LOCALITY
public static final CreateFlag NO_LOCAL_RACK
public static CreateFlag[] values()
for (CreateFlag c : CreateFlag.values()) System.out.println(c);
public static CreateFlag valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic 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 © 2020 Apache Software Foundation. All rights reserved.