|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.jgit.util.SystemReader
public abstract class SystemReader
Interface to read values from the system.
When writing unit tests, extending this interface with a custom class permits to simulate an access to a system variable or property and permits to control the user's global configuration.
Constructor Summary | |
---|---|
SystemReader()
|
Method Summary | |
---|---|
abstract long |
getCurrentTime()
|
DateFormat |
getDateTimeInstance(int dateStyle,
int timeStyle)
Returns a date/time format instance for the given styles. |
abstract String |
getenv(String variable)
|
abstract String |
getHostname()
Gets the hostname of the local host. |
static SystemReader |
getInstance()
|
Locale |
getLocale()
|
abstract String |
getProperty(String key)
|
SimpleDateFormat |
getSimpleDateFormat(String pattern)
Returns a simple date format instance as specified by the given pattern. |
TimeZone |
getTimeZone()
|
abstract int |
getTimezone(long when)
|
boolean |
isMacOS()
|
boolean |
isWindows()
|
abstract FileBasedConfig |
openSystemConfig(Config parent,
FS fs)
|
abstract FileBasedConfig |
openUserConfig(Config parent,
FS fs)
|
static void |
setInstance(SystemReader newReader)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SystemReader()
Method Detail |
---|
public static SystemReader getInstance()
public static void setInstance(SystemReader newReader)
newReader
- the new instance to use when accessing properties.public abstract String getHostname()
public abstract String getenv(String variable)
variable
- system variable to read
public abstract String getProperty(String key)
key
- of the system property to read
public abstract FileBasedConfig openUserConfig(Config parent, FS fs)
parent
- a config with values not found directly in the returned configfs
- the file system abstraction which will be necessary to perform
certain file system operations.
public abstract FileBasedConfig openSystemConfig(Config parent, FS fs)
parent
- a config with values not found directly in the returned
config. Null is a reasonable value here.fs
- the file system abstraction which will be necessary to perform
certain file system operations.
public abstract long getCurrentTime()
public abstract int getTimezone(long when)
when
- TODO
public TimeZone getTimeZone()
public Locale getLocale()
public SimpleDateFormat getSimpleDateFormat(String pattern)
pattern
- the pattern as defined in
SimpleDateFormat.SimpleDateFormat(String)
public DateFormat getDateTimeInstance(int dateStyle, int timeStyle)
dateStyle
- the date style as specified in
DateFormat.getDateTimeInstance(int, int)
timeStyle
- the time style as specified in
DateFormat.getDateTimeInstance(int, int)
public boolean isWindows()
public boolean isMacOS()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |