Package net.jcores.jre.utils.internal

Examples of net.jcores.jre.utils.internal.Options


     * @param delay The delay after which the function will be executed.
     * @param options May accept a {@link KillSwitch}.
     */
    @SupportsOption(options = { KillSwitch.class })
    public void oneTime(final F0 f0, final long delay, final Option... options) {
        final Options options$ = Options.$(this.commonCore, options);
        final KillSwitch killswitch = options$.killswitch();
        final Future<?> submit = this.commonCore.executor().getExecutor().submit(new Runnable() {
            @Override
            public void run() {
                try {
                    sleep(delay, options);

                    // Check if we should terminate
                    if (killswitch != null && killswitch.terminated()) return;

                    f0.f();
                } catch (Exception e) {
                    options$.failure(f0, e, "onetime:run", "Exception while executing f().");
                }
            }
        });

        // Register the future
View Full Code Here


     *
     * @param options The default options supported.
     * @return Return <code>this</code>.
     */
    public CoreAudioInputStream play(final Option... options) {
        final Options $ = Options.$(this.commonCore, options);
       
        forEach(new F1<AudioInputStream, Void>() {
            @Override
            public Void f(AudioInputStream x) {
                Sound.playSound(x, $);
View Full Code Here

     *
     * @return A CoreInputStream object enclosing the opened input streams.
     */
    @SupportsOption(options = {OnFailure.class})
    public CoreInputStream input(Option ... options) {
        final Options options$ = Options.$(this.commonCore, options);

        return new CoreInputStream(this.commonCore, map(new F1<URI, InputStream>() {
            public InputStream f(URI x) {
                try {
                    final URL url = x.toURL();
                    final InputStream openStream = url.openStream();
                    return openStream;
                } catch (MalformedURLException e) {
                    options$.failure(x, e, "input:urimalformed", "Malformed URI.");
                } catch (IOException e) {
                    options$.failure(x, e, "input:ioerror", "Error opening the URI.");
                }

                return null;
            }
        }).array(InputStream.class));
View Full Code Here

TOP

Related Classes of net.jcores.jre.utils.internal.Options

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.