public final class SwiftUtils extends Object
| Constructor and Description |
|---|
SwiftUtils() |
| Modifier and Type | Method and Description |
|---|---|
static void |
debug(org.apache.commons.logging.Log log,
String text,
Object... args)
Sprintf() to the log iff the log is at debug level.
|
static void |
debugEx(org.apache.commons.logging.Log log,
String text,
Exception ex)
Log an exception (in text and trace) iff the log is at debug
|
static String |
fileStatsToString(FileStatus[] stats,
String separator)
Take an array of filestats and convert to a string (prefixed w/ a [01] counter
|
static boolean |
isDirectory(FileStatus fileStatus)
This test contains the is-directory logic for Swift, so if
changed there is only one place for it.
|
static boolean |
isFilePretendingToBeDirectory(FileStatus fileStatus)
Test for the entry being a file that is treated as if it is a
directory
|
static boolean |
isRootDir(SwiftObjectPath swiftObject)
Predicate: Is a swift object referring to the root direcory?
|
static String |
joinPaths(String path1,
String path2)
Join two (non null) paths, inserting a forward slash between them
if needed
|
static String |
ls(FileSystem fileSystem,
Path path)
List a a path to string
|
static String |
partitionFilenameFromNumber(int partNumber)
Given a partition number, calculate the partition value.
|
static void |
trace(org.apache.commons.logging.Log log,
String text,
Object... args)
Sprintf() to the log iff the log is at trace level.
|
static void |
validateReadArgs(byte[] buffer,
int off,
int len)
Verify that the basic args to a read operation are valid;
throws an exception if not -with meaningful text includeing
|
public static final String READ
public static String joinPaths(String path1, String path2)
path1 - first pathpath2 - second pathpublic static boolean isDirectory(FileStatus fileStatus)
fileStatus - status to examinepublic static boolean isFilePretendingToBeDirectory(FileStatus fileStatus)
fileStatus - statuspublic static boolean isRootDir(SwiftObjectPath swiftObject)
swiftObject - object to probepublic static void debug(org.apache.commons.logging.Log log,
String text,
Object... args)
log - log to usetext - text messageargs - args arguments to the print statementpublic static void debugEx(org.apache.commons.logging.Log log,
String text,
Exception ex)
log - Log to usetext - text messageex - exceptionpublic static void trace(org.apache.commons.logging.Log log,
String text,
Object... args)
log - log to usetext - text messageargs - args arguments to the print statementpublic static String partitionFilenameFromNumber(int partNumber)
partNumber - part numberpublic static String ls(FileSystem fileSystem, Path path) throws IOException
fileSystem - filesystempath - directoryIOException - connectivity problemspublic static String fileStatsToString(FileStatus[] stats, String separator)
stats - array of statsseparator - separator after every entrypublic static void validateReadArgs(byte[] buffer,
int off,
int len)
buffer - destination bufferoff - offsetlen - number of bytes to readNullPointerException - null bufferIndexOutOfBoundsException - on any invalid range.Copyright © 2018 CERN. All Rights Reserved.