Package org.apache.maven.index.reader
Class Utils
- java.lang.Object
-
- org.apache.maven.index.reader.Utils
-
public final class Utils extends java.lang.Object
Reusable code snippets and constants.- Since:
- 5.1.2
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
FIELD_SEPARATOR
static java.util.regex.Pattern
FS_PATTERN
static java.text.DateFormat
INDEX_DATE_FORMAT
static java.lang.String
INDEX_FILE_PREFIX
static java.lang.String
INFO
static java.lang.String
NOT_AVAILABLE
static java.lang.String
UINFO
-
Constructor Summary
Constructors Modifier Constructor Description private
Utils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Record
allGroups(java.util.Collection<java.lang.String> allGroups)
Creates a record of typeRecord.Type.ALL_GROUPS
.static Record
descriptor(java.lang.String repoId)
Creates a record of typeRecord.Type.DESCRIPTOR
.static java.util.Properties
loadProperties(java.io.InputStream inputStream)
Creates and loadsProperties
from providedInputStream
and closes the stream.static java.util.Properties
loadProperties(ResourceHandler.Resource resource)
Creates and loadsProperties
from providedResourceHandler.Resource
if exists, and closes the resource.static java.lang.String
nvl(java.lang.String v)
Helper to translatenull
into "NA" (not available) value.static java.lang.String
renvl(java.lang.String v)
Helper to translate the "NA" (not available) input intonull
value.static java.lang.String
rootGroup(java.lang.String groupId)
Returns the "root group" of given groupId.static Record
rootGroups(java.util.Collection<java.lang.String> rootGroups)
Creates a record of typeRecord.Type.ROOT_GROUPS
.static void
storeProperties(java.io.OutputStream outputStream, java.util.Properties properties)
SavesProperties
to providedOutputStream
and closes the stream.static void
storeProperties(WritableResourceHandler.WritableResource writableResource, java.util.Properties properties)
SavesProperties
to providedWritableResourceHandler.WritableResource
and closes the resource.
-
-
-
Field Detail
-
INDEX_FILE_PREFIX
public static final java.lang.String INDEX_FILE_PREFIX
- See Also:
- Constant Field Values
-
INDEX_DATE_FORMAT
public static final java.text.DateFormat INDEX_DATE_FORMAT
-
FIELD_SEPARATOR
public static final java.lang.String FIELD_SEPARATOR
- See Also:
- Constant Field Values
-
NOT_AVAILABLE
public static final java.lang.String NOT_AVAILABLE
- See Also:
- Constant Field Values
-
UINFO
public static final java.lang.String UINFO
- See Also:
- Constant Field Values
-
INFO
public static final java.lang.String INFO
- See Also:
- Constant Field Values
-
FS_PATTERN
public static final java.util.regex.Pattern FS_PATTERN
-
-
Method Detail
-
loadProperties
public static java.util.Properties loadProperties(java.io.InputStream inputStream) throws java.io.IOException
Creates and loadsProperties
from providedInputStream
and closes the stream.- Throws:
java.io.IOException
-
loadProperties
public static java.util.Properties loadProperties(ResourceHandler.Resource resource) throws java.io.IOException
Creates and loadsProperties
from providedResourceHandler.Resource
if exists, and closes the resource. If not exists, returnsnull
.- Throws:
java.io.IOException
-
storeProperties
public static void storeProperties(java.io.OutputStream outputStream, java.util.Properties properties) throws java.io.IOException
SavesProperties
to providedOutputStream
and closes the stream.- Throws:
java.io.IOException
-
storeProperties
public static void storeProperties(WritableResourceHandler.WritableResource writableResource, java.util.Properties properties) throws java.io.IOException
SavesProperties
to providedWritableResourceHandler.WritableResource
and closes the resource.- Throws:
java.io.IOException
-
descriptor
public static Record descriptor(java.lang.String repoId)
Creates a record of typeRecord.Type.DESCRIPTOR
.
-
allGroups
public static Record allGroups(java.util.Collection<java.lang.String> allGroups)
Creates a record of typeRecord.Type.ALL_GROUPS
.
-
rootGroups
public static Record rootGroups(java.util.Collection<java.lang.String> rootGroups)
Creates a record of typeRecord.Type.ROOT_GROUPS
.
-
renvl
public static java.lang.String renvl(java.lang.String v)
Helper to translate the "NA" (not available) input intonull
value.
-
nvl
public static java.lang.String nvl(java.lang.String v)
Helper to translatenull
into "NA" (not available) value.
-
rootGroup
public static java.lang.String rootGroup(java.lang.String groupId)
Returns the "root group" of given groupId.
-
-