Search in sources :

Example 1 with UncheckedIOException

use of com.stardust.pio.UncheckedIOException in project Auto.js by hyb1996.

the class JavaScriptHighlighter method updateTokens.

public void updateTokens(String sourceString) {
    final int id = mRunningHighlighterId.incrementAndGet();
    mExecutorService.execute(() -> {
        try {
            mLogger.reset();
            updateTokens(sourceString, id);
            mLogger.addSplit("parse tokens");
            mLogger.dumpToLog();
        } catch (IOException neverHappen) {
            throw new UncheckedIOException(neverHappen);
        }
    });
}
Also used : UncheckedIOException(com.stardust.pio.UncheckedIOException) IOException(java.io.IOException) UncheckedIOException(com.stardust.pio.UncheckedIOException)

Example 2 with UncheckedIOException

use of com.stardust.pio.UncheckedIOException in project Auto.js by hyb1996.

the class Media method playMusic.

public void playMusic(String path, float volume, boolean looping) {
    if (mMediaPlayer == null) {
        mMediaPlayer = new MediaPlayerWrapper();
    }
    mMediaPlayer.stopAndReset();
    try {
        mMediaPlayer.setDataSource(path);
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }
    mMediaPlayer.setVolume(volume, volume);
    mMediaPlayer.setLooping(looping);
    mMediaPlayer.start();
}
Also used : UncheckedIOException(com.stardust.pio.UncheckedIOException) IOException(java.io.IOException) UncheckedIOException(com.stardust.pio.UncheckedIOException)

Example 3 with UncheckedIOException

use of com.stardust.pio.UncheckedIOException in project Auto.js by hyb1996.

the class ProcessShell method init.

@Override
protected void init(String initialCommand) {
    try {
        mProcess = new ProcessBuilder(initialCommand).redirectErrorStream(true).start();
        mCommandOutputStream = new DataOutputStream(mProcess.getOutputStream());
        mSucceedReader = new BufferedReader(new InputStreamReader(mProcess.getInputStream()));
        mErrorReader = new BufferedReader(new InputStreamReader(mProcess.getErrorStream()));
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }
}
Also used : InputStreamReader(java.io.InputStreamReader) DataOutputStream(java.io.DataOutputStream) BufferedReader(java.io.BufferedReader) UncheckedIOException(com.stardust.pio.UncheckedIOException) IOException(java.io.IOException) UncheckedIOException(com.stardust.pio.UncheckedIOException)

Example 4 with UncheckedIOException

use of com.stardust.pio.UncheckedIOException in project Auto.js by hyb1996.

the class Shell method init.

@Override
protected void init(final String initialCommand) {
    Handler uiHandler = new Handler(mContext.getMainLooper());
    uiHandler.post(new Runnable() {

        @Override
        public void run() {
            TermSettings settings = new TermSettings(mContext.getResources(), PreferenceManager.getDefaultSharedPreferences(mContext));
            try {
                mTermSession = new MyShellTermSession(settings, initialCommand);
                mTermSession.initializeEmulator(1024, 40);
            } catch (IOException e) {
                mInitException = new UncheckedIOException(e);
            }
        }
    });
}
Also used : TermSettings(jackpal.androidterm.util.TermSettings) Handler(android.os.Handler) UncheckedIOException(com.stardust.pio.UncheckedIOException) IOException(java.io.IOException) UncheckedIOException(com.stardust.pio.UncheckedIOException)

Example 5 with UncheckedIOException

use of com.stardust.pio.UncheckedIOException in project Auto.js by hyb1996.

the class JsBeautifier method compile.

private void compile() {
    try {
        enterContext();
        InputStream is = mContext.getAssets().open(mBeautifyJsPath);
        if (mScriptable == null)
            mScriptable = mScriptContext.initSafeStandardObjects();
        mJsBeautifyFunction = (Function) mScriptContext.evaluateString(mScriptable, PFiles.read(is), "<js_beautify>", 1, null);
    } catch (IOException e) {
        exitContext();
        throw new UncheckedIOException(e);
    }
}
Also used : InputStream(java.io.InputStream) UncheckedIOException(com.stardust.pio.UncheckedIOException) IOException(java.io.IOException) UncheckedIOException(com.stardust.pio.UncheckedIOException)

Aggregations

UncheckedIOException (com.stardust.pio.UncheckedIOException)5 IOException (java.io.IOException)5 Handler (android.os.Handler)1 TermSettings (jackpal.androidterm.util.TermSettings)1 BufferedReader (java.io.BufferedReader)1 DataOutputStream (java.io.DataOutputStream)1 InputStream (java.io.InputStream)1 InputStreamReader (java.io.InputStreamReader)1