public class Npmrc extends Object
| Constructor and Description |
|---|
Npmrc() |
| Modifier and Type | Method and Description |
|---|---|
void |
addComment(String comment)
Add a comment line at the end of the file.
|
boolean |
contains(String key)
Returns true if this map contains a user config for the
specified key.
|
void |
from(String content)
Parse the given content and store internally all user settings and
comments.
|
String |
get(String key)
Get the value for the specified property key.
|
Boolean |
getAsBoolean(String key)
Get the value for the specified property key as a boolean.
|
Integer |
getAsNumber(String key)
Get the value for the specified property key as a number.
|
static Npmrc |
load(File file)
Parse the given file and store internally all user settings and
comments.
|
void |
save(File file)
Write the content of user config to a file.
|
boolean |
set(String key,
boolean value)
Set the value for the specified property key.
|
String |
set(String key,
String value)
Set the value for the specified property key.
|
String |
toString() |
public static Npmrc load(File file) throws IOException
file - a valid npmrc user config file content.IOException - in case of I/O failure during file readpublic void from(String content)
content - a valid npmrc user config content.public void addComment(String comment)
comment - the text content without the ';' prefixpublic void save(File file) throws IOException
file - the destination fileIOException - in case of I/O write errorpublic boolean contains(String key)
key - user setting whose presence in this configpublic String get(String key)
key - user config entry keypublic String set(String key, String value)
key - property keyvalue - property valuepublic boolean set(String key, boolean value)
key - property keyvalue - property valuepublic Boolean getAsBoolean(String key)
key - user config entry keyCopyright © 2016–2017. All rights reserved.