@MinDoc(copyright="Copyright 1999 - 2009, 2021 A. Weinert", author="Albrecht Weinert", version="V.50", lastModified="4.06.2021", usage="use the basic services", purpose="provide helper methods for applications") public abstract class AppHelper extends Object
weinert-automation.de a-weinert.de
/ / /\
/ /___ / \ |
\ /____\ /____\ | _|__
\ /\ / \ / \| |
\/ \/ \__/ \__/|_
TextHelper
,
Verbos
Modifier and Type | Field and Description |
---|---|
static Class<?>[] |
ECL
Empty Class array.
|
static Object[] |
EOB
Empty Object array.
|
Modifier and Type | Method and Description |
---|---|
static String |
getActTime()
The actual (system) time as text.
|
static InputStream |
getAsRessourceStream(CharSequence fileName)
Designate an input stream from a file or a resource.
|
static Timer |
getTimer()
Fetch one (singleton) Timer.
|
static long |
scheduleAbsolute(TimerTask task,
long start,
long period)
Schedule a task for absolute start and repeated execution.
|
static void |
scheduleAtFixedRate(TimerTask task,
long delay,
long period)
Schedule a task for relative (delayed) start and repeated execution.
|
static void |
setProxy(boolean on,
String proxyHost,
String proxyPort)
Set the system properties governing the use of a (LAN) proxy.
|
static boolean |
sleep(long millis)
Delay programme execution by just waiting.
|
public static final Class<?>[] ECL
public static final Object[] EOB
public static final boolean sleep(long millis)
Thread
.sleep(long)
.Thread
's method this
sleep()
throws no Exception. An early return due to
an interrupt of the wait/sleep is signalled by returning false.millis
- (>0 !) wait time in msComVar.ONE_MINUTE
,
ComVar.ONE_HOUR
,
ComVar.ONE_DAY
public static void setProxy(boolean on, String proxyHost, String proxyPort)
on
- false: use no proxy; both other parameters are taken in, even
if so of no relevance.proxyHost
- Name of the proxy server of this (LAN) network segment
(often proyx or cache); null or empty means no change.proxyPort
- Port of the proxy server of this (LAN) network segment;
(often 8080); null or empty means no change.public static String getActTime()
Time stamp
is
updated
to system clock and then
formatted according to AppLangMap
.valueUL("wedaclock")
.public static InputStream getAsRessourceStream(CharSequence fileName) throws SecurityException
fileName
it is tried to produce and return
an input stream connected or related to the class loader registered
at start in ComVar
.FRW_CLLD
. Normally
this would be a file contained in the
(Frame4J's) deployment
.jar-file.FRW_CLLD
) is known or if no resource named
fileName
could be determined or found.SecurityException
- if the trials to determine the resource were
denied due to security reasons.public static Timer getTimer()
Timer
is able to handle thousands of
TimerTask
s also for multiple Thread
s.Timer.cancel()
shall never be called for this singleton
Timer. It would destroy it for other users.public static void scheduleAtFixedRate(TimerTask task, long delay, long period) throws IllegalStateException, IllegalArgumentException
Timer.scheduleAtFixedRate(java.util.TimerTask, long, long)
.task
- the task to be scheduleddelay
- very first start delay in ms (>= 0 !)period
- repeating period in ms (> 0 !)IllegalArgumentException
- if parameter values point to the pastIllegalStateException
- if the task task was scheduled already or if
it or the timer
was stoppedgetTimer()
public static long scheduleAbsolute(TimerTask task, long start, long period) throws IllegalStateException, IllegalArgumentException, NullPointerException
scheduleAtFixedRate(TimerTask, long, long)
. The difference is
start
being an absolute starting time as ms.Timer
). The used start time is the return value.task
- the task planned to runstart
- the time for first start (>= year 2009 !)period
- repeat rate in ms (milliseconds, > 10 !)IllegalArgumentException
- falls die Parameter point (to far) into
pastIllegalStateException
- if the task was planned already or if it or
the Timer has ended alreadyNullPointerException
- if task is nullgetTimer()