public final class AliyunOSSUtils
extends java.lang.Object
| Modifier and Type | Method | Description |
|---|---|---|
static long |
calculatePartSize(long contentLength,
long minPartSize) |
Calculate a proper size of multipart piece.
|
static java.io.File |
createTmpFileForWrite(java.lang.String pathStr,
long size,
org.apache.hadoop.conf.Configuration conf) |
Demand create the directory allocator, then create a temporary file.
|
static com.aliyun.oss.common.auth.CredentialsProvider |
getCredentialsProvider(java.net.URI uri,
org.apache.hadoop.conf.Configuration conf) |
Create credential provider specified by configuration, or create default
credential provider if not specified.
|
static long |
getMultipartSizeProperty(org.apache.hadoop.conf.Configuration conf,
java.lang.String property,
long defVal) |
Get a size property from the configuration: this property must
be at least equal to
Constants.MULTIPART_MIN_SIZE. |
static java.lang.String |
getValueWithKey(org.apache.hadoop.conf.Configuration conf,
java.lang.String key) |
Used to get password from configuration.
|
static int |
intPositiveOption(org.apache.hadoop.conf.Configuration conf,
java.lang.String key,
int defVal) |
|
static java.lang.String |
maybeAddTrailingSlash(java.lang.String key) |
Turns a path (relative or otherwise) into an OSS key, adding a trailing
"/" if the path is not the root and does not already have a "/"
at the end.
|
static boolean |
objectRepresentsDirectory(java.lang.String name,
long size) |
Check if OSS object represents a directory.
|
public static int intPositiveOption(org.apache.hadoop.conf.Configuration conf,
java.lang.String key,
int defVal)
public static java.lang.String getValueWithKey(org.apache.hadoop.conf.Configuration conf,
java.lang.String key)
throws java.io.IOException
conf - configuration that contains password informationkey - the key of the passwordjava.io.IOException - if failed to get password from configurationpublic static long calculatePartSize(long contentLength,
long minPartSize)
minPartSize
is too small, the number of multipart pieces may exceed the limit of
Constants.MULTIPART_UPLOAD_PART_NUM_LIMIT.contentLength - the size of file.minPartSize - the minimum size of multipart piece.public static com.aliyun.oss.common.auth.CredentialsProvider getCredentialsProvider(java.net.URI uri,
org.apache.hadoop.conf.Configuration conf)
throws java.io.IOException
uri - uri passed by callerconf - configurationjava.io.IOException - on any problem. Class construction issues may be
nested inside the IOE.public static java.lang.String maybeAddTrailingSlash(java.lang.String key)
key - OSS key or ""public static boolean objectRepresentsDirectory(java.lang.String name,
long size)
name - object keysize - object content lengthpublic static java.io.File createTmpFileForWrite(java.lang.String pathStr,
long size,
org.apache.hadoop.conf.Configuration conf)
throws java.io.IOException
LocalDirAllocator.createTmpFileForWrite(
String, long, Configuration).pathStr - prefix for the temporary filesize - the size of the file that is going to be writtenconf - the Configuration objectjava.io.IOException - IO problemspublic static long getMultipartSizeProperty(org.apache.hadoop.conf.Configuration conf,
java.lang.String property,
long defVal)
Constants.MULTIPART_MIN_SIZE.
If it is too small, it is rounded up to that minimum, and a warning
printed.conf - configurationproperty - property namedefVal - default valueCopyright © 2008–2025 Apache Software Foundation. All rights reserved.