Package org.apache.maven.building
Class StringSource
- java.lang.Object
-
- org.apache.maven.building.StringSource
-
- All Implemented Interfaces:
Source
- Direct Known Subclasses:
StringModelSource,StringSettingsSource
public class StringSource extends java.lang.Object implements Source
Wraps an ordinaryCharSequenceas a source.
-
-
Constructor Summary
Constructors Constructor Description StringSource(java.lang.CharSequence content)Creates a new source backed by the specified string.StringSource(java.lang.CharSequence content, java.lang.String location)Creates a new source backed by the specified string.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetContent()Gets the content of this source.java.io.InputStreamgetInputStream()Gets a byte stream to the source contents.java.lang.StringgetLocation()Provides a user-friendly hint about the location of the source.java.lang.StringtoString()
-
-
-
Constructor Detail
-
StringSource
public StringSource(java.lang.CharSequence content)
Creates a new source backed by the specified string.- Parameters:
content- The String representation, may be empty ornull.
-
StringSource
public StringSource(java.lang.CharSequence content, java.lang.String location)Creates a new source backed by the specified string.- Parameters:
content- The String representation, may be empty ornull.location- The location to report for this use, may benull.
-
-
Method Detail
-
getInputStream
public java.io.InputStream getInputStream() throws java.io.IOExceptionDescription copied from interface:SourceGets a byte stream to the source contents. Closing the returned stream is the responsibility of the caller.- Specified by:
getInputStreamin interfaceSource- Returns:
- A byte stream to the source contents, never
null. - Throws:
java.io.IOException
-
getLocation
public java.lang.String getLocation()
Description copied from interface:SourceProvides a user-friendly hint about the location of the source. This could be a local file path, a URI or just an empty string. The intention is to assist users during error reporting.- Specified by:
getLocationin interfaceSource- Returns:
- A user-friendly hint about the location of the source, never
null.
-
getContent
public java.lang.String getContent()
Gets the content of this source.- Returns:
- The underlying character stream, never
null.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-