org.apache.maven.settings.building
Class StringSettingsSource

java.lang.Object
  extended by org.apache.maven.settings.building.StringSettingsSource
All Implemented Interfaces:
SettingsSource

public class StringSettingsSource
extends Object
implements SettingsSource

Wraps an ordinary CharSequence as a settings source.

Author:
Benjamin Bentmann

Constructor Summary
StringSettingsSource(CharSequence settings)
          Creates a new settings source backed by the specified string.
StringSettingsSource(CharSequence settings, String location)
          Creates a new settings source backed by the specified string.
 
Method Summary
 InputStream getInputStream()
          Gets a byte stream to the settings contents.
 String getLocation()
          Provides a user-friendly hint about the location of the settings.
 String getSettings()
          Gets the character sequence of this settings source.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StringSettingsSource

public StringSettingsSource(CharSequence settings)
Creates a new settings source backed by the specified string.

Parameters:
settings - The settings' string representation, may be empty or null.

StringSettingsSource

public StringSettingsSource(CharSequence settings,
                            String location)
Creates a new settings source backed by the specified string.

Parameters:
settings - The settings' string representation, may be empty or null.
location - The location to report for this use, may be null.
Method Detail

getInputStream

public InputStream getInputStream()
                           throws IOException
Description copied from interface: SettingsSource
Gets a byte stream to the settings contents. Closing the returned stream is the responsibility of the caller. Note that each invocation of this method returns a new/fresh stream which represents the entire contents.

Specified by:
getInputStream in interface SettingsSource
Returns:
A byte stream to the settings contents, never null.
Throws:
IOException

getLocation

public String getLocation()
Description copied from interface: SettingsSource
Provides a user-friendly hint about the location of the settings. 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:
getLocation in interface SettingsSource
Returns:
A user-friendly hint about the location of the settings, never null.

getSettings

public String getSettings()
Gets the character sequence of this settings source.

Returns:
The underlying character stream, never null.

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2001-2011 The Apache Software Foundation. All Rights Reserved.