input
stringlengths 10
828
| output
stringlengths 5
107
|
|---|---|
private object deref object o if o null o instanceof weak reference return weak reference o get else return null
|
extract the hard reference out of a weak reference
|
public property desc get property node node throws parse exception string name get required attribute node name null string value get required attribute node value return new property desc name value
|
returns the property element at the specified node
|
public object get int index return deref refs get index
|
returns the object at the specified index or null if the
|
public int size return refs size
|
returns the size of the list including already collected
|
public object set int index object element return deref refs set index new weak reference element
|
sets the object at the specified position and returns the
|
public long get amount read url location not atomic b c transferred is a long but so what each byte atomic so probably won t affect anything return get resource location transferred
|
returns the number of bytes downloaded for a resource
|
public void add int index object element refs add index new weak reference element
|
inserts the object at the specified position in the list
|
public object remove int index return deref refs remove index
|
removes the object at the specified position and returns it
|
public list hard list list result new array list for int i 0 i size i object tmp get i if tmp null result add tmp return result
|
returns a list of hard references to the objects
|
public void trim to size for int i size i 0 if get i null remove i
|
compacts the list by removing references to collected
|
public boolean is completed url location return get resource location is set downloaded error
|
returns whether a resource is available for use ie can be
|
public object invoke static string class name string method return invoke static class name method zero
|
invoke a zero parameter static method by name
|
public string get title return get information get title
|
returns the jnlp files title
|
public package desc get package node node throws parse exception string name get required attribute node name null string part get required attribute node part boolean recursive get attribute node recursive false equals true return new package desc name part recursive
|
returns the package element at the specified node
|
public url get document base return document base
|
returns the document base
|
public url get source location return source location
|
returns the jnlp files network location as specified in the
|
public map get parameters return new hash map parameters
|
returns the applet parameters
|
public object invoke static string class name string method object args try class c class for name class name true loader method m get method c method args return m invoke null args catch exception ex eat return null
|
invoke the static method using the specified parameters
|
public void add parameter string name string value parameters put name value
|
adds a parameter to the applet
|
public boolean start resource url location resource resource get resource location return start resource resource
|
starts loading the resource if it is not already being
|
public object get kind return kind
|
returns the icon type
|
public version get file version return file version
|
returns the jnlp files version
|
public object invoke method object target method method object args throws null pointer exception illegal argument exception undeclared throwable exception runtime exception error try if method null throw new illegal argument exception method not found return method invoke target args catch invocation target exception ex throwable cause invocation target exception ex get target exception if cause instanceof runtime exception throw runtime exception cause if cause instanceof error throw error cause throw new undeclared throwable exception cause catch illegal access exception ex throw new unsupported operation exception method access protection
|
invokes a method object unwraping the cause of
|
public version get spec version return spec version
|
returns the specification version required by the file
|
public list get info node parent throws parse exception list result new array list node info get child nodes parent information ensure that there are at least one information section present if info length 0 throw new parse exception r pno info element create objects from the info sections for int i 0 i info length i result add get information desc info i return result
|
returns all of the information elements under the specified
|
public boolean is version id if 1 version string index of return false return true
|
returns true if the version represents a i version id i a
|
public url get code base return code base
|
returns the codebase url for the jnlp file
|
private boolean start resource resource resource boolean enqueue false synchronized resource if resource is set error return true enqueue resource is set started if resource is set connected connecting resource change status 0 connect started if resource is set downloaded downloading resource change status 0 download started if resource is set download connect enqueue false if enqueue queue resource resource return enqueue
|
sets the resource status to connect and download and
|
public object invoke exception method object target method method object args throws exception try if method null throw new no such method exception return method invoke target args catch invocation target exception ex throwable cause invocation target exception ex get target exception if cause instanceof exception this way avoid having to declare throws throwable throw exception cause if cause instanceof error throw error cause throw new undeclared throwable exception ex
|
invokes a method object unwraping the cause of
|
public boolean matches string version return matches new version version
|
returns true if all of this versions version ids match one
|
public information desc get information return get information default locale
|
returns the information section of the jnlp file as viewed
|
public boolean matches version version list version strings version get version strings for int i 0 i version strings size i if this matches single string version strings get i return false return true
|
returns true if all of this versions version ids match one
|
public boolean matches any string version return matches new version version
|
returns true if any of this versions version ids match one
|
public information desc get information final locale locale return new information desc this new locale locale protected list get items object key list result new array list for int i 0 i info size i information desc info desc information desc info get i if local matches locale info desc get locales if local matches locale info desc get locales result add all info desc get items key return result
|
returns the information section of the jnlp file as viewed
|
public boolean matches any version version list version strings version get version strings for int i 0 i version strings size i if this matches single string version strings get i return true return false
|
returns true if any of this versions version ids match one
|
public object invoke object object string method return invoke object method zero
|
invoke a zero parameter method by name on the specified
|
public long get total size url location return get resource location size atomic
|
returns the number of total size in bytes of a resource or
|
private boolean matches single string version list version strings this get version strings for int i 0 i version strings size i if matches version string version strings get i return true return false
|
returns whether a single version string is supported by this
|
private boolean matches string subversion string version list subparts get parts subversion list parts get parts version int max length math max subversion length version length if version ends with star means rest of parts irrelevant truncate them max length parts size normalize new list subparts parts max length if equal subparts parts return true if version ends with greater subparts parts return true return false
|
returns whether a single version string is supported by
|
public security desc get security return security
|
returns the security section of the jnlp file
|
public object invoke object object string method object args try method m get method object get class method args return m invoke object args catch exception ex eat system out println can t access method message ex get message ex print stack trace return null
|
invoke a method by name with the specified parameters
|
protected boolean equal list parts1 list parts2 for int i 0 i parts1 size i if 0 compare string parts1 get i string parts2 get i return false return true
|
returns whether the parts of one version are equal to the
|
public resources desc get resources return get resources default locale default os default arch
|
returns a view of the information secion of the jnlp file
|
protected boolean greater list parts1 list parts2 if true return false for int i 0 i parts1 size i if part1 part2 then it s a later version so return true if compare string parts1 get i string parts2 get i 0 return true if part1 part2 then it s a ealier version so return false if compare string parts1 get i string parts2 get i 0 return false if equal go to next part all parts were equal return false not greater than
|
returns whether the parts of one version are greater than
|
protected void start thread if threads max threads threads thread thread new thread new downloader thread start
|
start a new download thread if there are not too many threads
|
protected int compare string part1 string part2 integer number1 new integer 0 integer number2 new integer 0 try to compare as integers try if part1 empty string compare to magic normalization key number1 integer value of part1 if part2 empty string compare to magic normalization key number2 integer value of part2 return number1 compare to number2 catch number format exception ex compare as strings if part1 empty string part1 if part2 empty string part2 return part1 compare to part2
|
compares two parts of a version string by value if both can
|
protected void normalize list versions int max length int length 0 for int i 0 i versions length i length math max length versions i size if length max length length max length for int i 0 i versions length i remove excess elements while versions i size length versions i remove versions i size 1 add in empty pad elements while versions i size length versions i add empty string
|
normalize version strings so that they contain the same
|
protected list get version strings array list strings new array list string tokenizer st new string tokenizer version string while st has more tokens strings add st next token return strings
|
return the individual version strings that make up a version
|
protected void add info information desc info node node string mod object value string mod str mod null mod if node null return info add item node get node name mod str value
|
adds a key value pair to the information object
|
private void end thread threads if threads 0 this should never happen but try to recover threads 0 if queue size 0 if any on queue make sure a thread is running start thread look into whether this could create a loop throw new runtime exception tracker threads 0 if threads 0 synchronized prefetch trackers queue trim to size these only accessed by threads so no sync needed active clear no threads so no trackers actively downloading active trim to size prefetch trackers trim to size
|
a thread is ending called by the thread itself
|
protected list get parts string one version array list strings new array list string tokenizer st new string tokenizer one version seperators while st has more tokens strings add st next token return strings
|
return the constituent parts of a version string
|
public void set static string class name string field object value try class c class for name class name true reflect class get class loader field f get field c field f set null value catch exception ex eat ex print stack trace
|
sets the static fields value
|
public object get launch info return launch type
|
returns an object of one of the following types applet desc
|
public applet desc get applet if is applet throw new unsupported operation exception r jnot applet return applet desc launch type
|
returns the launch information for an applet
|
private void queue resource resource resource synchronized lock if resource is set connect download throw new illegal argument exception invalid resource state resource resource queue add resource start thread
|
add a resource to the queue and start a thread to download or
|
public object get static string class name string field try class c class for name class name true reflect class get class loader field f get field c field return f get null catch exception ex eat ex print stack trace return null
|
gets the static fields value
|
public icon desc get icon node node throws parse exception int width integer parse int get attribute node width 1 int height integer parse int get attribute node height 1 int size integer parse int get attribute node size 1 int depth integer parse int get attribute node depth 1 url location get required url node href base object kind get attribute node kind default return new icon desc location kind width height depth size
|
returns the icon element at the specified node
|
public application desc get application if is application throw new unsupported operation exception r jnot application return application desc launch type
|
returns the launch information for an application
|
public boolean is exit class return is exit class get class context
|
returns whether the exit class is present on the stack or
|
public component desc get component if is component throw new unsupported operation exception r jnot component return component desc launch type
|
returns the launch information for a component
|
private boolean is exit class class stack if exit class null return true for int i 0 i stack length i if stack i exit class return true return false
|
returns whether the exit class is present on the stack or
|
public void set exit class class exit class throws illegal state exception if this exit class null throw new illegal state exception r rexit taken this exit class exit class
|
set the exit class which is the only class that can exit the
|
private void process resource resource resource boolean do connect false boolean do download false synchronized resource if resource is set connecting do connect true if do connect initialize resource resource synchronized lock synchronized resource return to queue if we just initalized but it still needs to download not cached locally out of date if resource is set download would be downloading if connected before this method queue resource resource if resource is set downloading do download true if do download download resource resource
|
process the resource by either downloading it or initializing
|
public void set object object string field object value try field f get field object get class field f set object value catch exception ex eat ex print stack trace
|
sets the fields value
|
public installer desc get installer if is installer throw new unsupported operation exception r not installer return installer desc launch type
|
returns the launch information for an installer
|
protected application instance get application return get application get class context 0
|
return the current application or null if none can be
|
protected application instance get application window window for int i weak windows size i 0 window w window weak windows get i if w null weak windows remove i weak applications remove i if w window return application instance weak applications get i return null
|
return the application the opened the specified window only
|
public boolean is applet return launch type instanceof applet desc
|
returns whether the lauch descriptor describes an applet
|
protected application instance get application class stack int max depth if max depth 0 max depth stack length this needs to be tightened up for int i 0 i stack length i max depth i if stack i get class loader instanceof jnlpclass loader jnlpclass loader loader jnlpclass loader stack i get class loader if loader null loader get application null return loader get application return null
|
return the current application or null
|
public object get object object string field try field f get field object get class field return f get object catch exception ex eat ex print stack trace return null
|
returns the fields value
|
public boolean is application return launch type instanceof application desc
|
returns whether the lauch descriptor describes an application
|
public thread group get thread group application instance app get application if app null return super get thread group return app get thread group
|
returns the applications thread group if the application can
|
public void check permission permission perm string name perm get name if set policy equals name set security manager equals name throw new security exception r rcant replace sm try deny all permissions to stopped applications if jnlpruntime is debug if get class loader equals name application instance app get application if app null app is running throw new security exception r rdeny stopped super check permission perm catch security exception ex if jnlpruntime is debug system out println denying permission perm throw ex
|
throws a security exception if the permission is denied
|
protected boolean is trusted environment node security get child node root security if security null if get child node security all permissions null get child node security j2ee application client permissions null return true return false
|
returns whether the jnlp file requests a trusted execution
|
public field get field class type string field try for class c type c null c c get superclass field fields c get declared fields for int i 0 i fields length i if fields i get name equals field if fields i is accessible accessible fields i set accessible accessible return fields i catch exception ex eat ex print stack trace return null
|
get a field matching the specified name
|
public boolean is component return launch type instanceof component desc
|
returns whether the lauch descriptor describes a component
|
public boolean is installer return launch type instanceof installer desc
|
returns whether the lauch descriptor describes an installer
|
public object get security type jnlpfile file if type null return type return file get security get security type
|
returns the permission type for the application
|
public void set defaults string os string arch locale locale default os os default arch arch default locale locale
|
sets the default view of the jnlp file returned by
|
public void add application listener application listener listener listeners add application listener class listener
|
add an application listener
|
public void remove application listener application listener listener listeners remove application listener class listener
|
remove an application listener
|
protected void fire destroyed object list listeners get listener list application event event null for int i list length 1 i 0 i 2 last to first required if event null event new application event this application listener list i application destroyed event
|
notify listeners that the application has been terminated
|
private boolean local matches locale requested locale available if available null available length 0 return true for int i 0 i available length i string language requested get language but never null string country requested get country string variant requested get variant if equals language language equals ignore case available i get language continue if equals country country equals ignore case available i get country continue if equals variant variant equals ignore case available i get variant continue return true return false
|
returns whether a locale is matched by one of more other
|
public void set app context object context this context context
|
sets the applications app context so that app specific
|
private resource get resource url location synchronized resources for int i 0 i resources size i resource resource resource resources get i if cache util url equals resource location location return resource throw new illegal argument exception location does not specify a resource being tracked
|
return the resource matching the specified url
|
private boolean string matches string whole string prefixes if prefixes null prefixes length 0 return true for int i 0 i prefixes length i if prefixes i null whole starts with prefixes i return true return false
|
returns whether a string is prefixed by any of a set of
|
public void finalize destroy
|
releases the applications resources before it is collected
|
public string get main class name string result file get application get main class if result null loader instanceof jnlpclass loader manifest mf jnlpclass loader loader get manifest if mf null result mf get main attributes get value main class return result
|
returns the main class name
|
public void set resizable boolean resizable environment get applet frame set resizable resizable
|
sets whether the applet is resizable or not
|
public boolean is resizable return environment get applet frame is resizable
|
returns whether the applet is resizable
|
public string get title return get jnlpfile get applet get name
|
returns the application title
|
public string get title return file get title
|
returns the application title
|
private boolean wait resource resources long timeout throws interrupted exception long start time system current time millis start them downloading connecting in background for int i 0 i resources length i start resource resources i wait for completion while true boolean finished true synchronized lock check for completion for int i 0 i resources length i synchronized resources i if resources i is set downloaded error finished false break if finished return true wait long wait time 0 if timeout 0 wait time timeout system current time millis start time if wait time 0 return false lock wait wait time
|
wait for some resources
|
public applet get applet return applet
|
returns the applet
|
public boolean is running return stopped
|
returns whether the application is running
|
public void destroy if applet stopped return applet stopped true try applet stop applet destroy catch exception ex if jnlpruntime is debug ex print stack trace environment destroy super destroy
|
stop the application and destroy its resources
|
public void destroy if stopped return access controller do privileged new privileged action public object run thread destroyer new thread group get parent destroyer public void run destroy0 destroyer start return null
|
stop the application and destroy its resources
|
public void loop if clip null return clip loop clip loop continuously
|
plays the clip in a continuous loop until the stop method is
|
public void play if clip null return applet audio clip resets to beginning when played again clip stop clip set frame position 0 clip start
|
plays the clip from the beginning
|
public void stop if clip null return clip stop
|
stops playing the clip
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.