public final class Utils extends Object
| Modifier and Type | Method and Description |
|---|---|
static InputStream |
asInputStream(Object content)
Returns an input stream for the specified content.
|
static String |
getArtifactId(org.apache.maven.model.Model model)
Extract the artifactId from an un-interpolated model.
|
static String |
getGAVPath(String groupId,
String artifactId,
String version)
Converts a GAV coordinate into the repository path for the directory containing all artifacts at that GAV.
|
static String |
getGAVPathName(String groupId,
String artifactId,
String version)
Converts a GAV coordinate into the base file path and name for all artifacts at that coordinate.
|
static String |
getGroupId(org.apache.maven.model.Model model)
Extract the groupId from an un-interpolated model.
|
static String |
getVersion(org.apache.maven.model.Model model)
Extract the version from an un-interpolated model.
|
static byte[] |
newEmptyJarContent()
Creates an empty jar file.
|
static byte[] |
newEmptyMavenPluginJarContent(String groupId,
String artifactId,
String version)
Creates an empty maven plugin jar file.
|
static String |
urlEncodePath(String path)
Take a path and encode it for use as an URL parameter.
|
static String |
urlEncodePathSegment(String pathSegment)
Take a path segment and encode it for use as an URL parameter.
|
public static InputStream asInputStream(Object content) throws IOException
ByteArrayInputStream if the content is a File, the input stream will be a
FileInputStream otherwise the content will be converted to a String and then into its UTF-8
representation and a ByteArrayInputStream returned.content - The content.IOException - if things go wrong.public static byte[] newEmptyJarContent()
throws IOException
IOException - if things go wrong.public static byte[] newEmptyMavenPluginJarContent(String groupId, String artifactId, String version) throws IOException
groupId - the group id of the plugin.artifactId - the artifact id of the plugin.version - the version of the plugin.IOException - if things go wrong.public static String getGAVPathName(String groupId, String artifactId, String version)
groupId - the group id.artifactId - the artifact id.version - the version.public static String getGAVPath(String groupId, String artifactId, String version)
groupId - the group id.artifactId - the artifact id (may be null to just get the path of the groupId)version - the version (may be null to just get the path of the groupId:artifactId)public static String getVersion(org.apache.maven.model.Model model)
model - the model.public static String getArtifactId(org.apache.maven.model.Model model)
model - the model.public static String getGroupId(org.apache.maven.model.Model model)
model - the model.public static String urlEncodePath(String path) throws UnsupportedEncodingException
path - the path.UnsupportedEncodingException - if the path cannot be encoded.public static String urlEncodePathSegment(String pathSegment) throws UnsupportedEncodingException
pathSegment - the path segment.UnsupportedEncodingException - if the path cannot be encoded.Copyright © 2009–2022 MojoHaus. All rights reserved.