Java Code Examples for skadistats.clarity.decoder.Util#uncheckedThrow()

The following examples show how to use skadistats.clarity.decoder.Util#uncheckedThrow() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BitStream.java    From clarity with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
public String readString(int n) {
    int o = 0;
    while (o < n) {
        byte c = (byte) readUBitInt(8);
        if (c == 0) {
            break;
        }
        stringTemp[o] = c;
        o++;
    }
    try {
        return new String(stringTemp, 0, o, "UTF-8");
    } catch (UnsupportedEncodingException e) {
        Util.uncheckedThrow(e);
        return null;
    }
}
 
Example 2
Source File: ReplayController.java    From clarity-analyzer with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public void haltIfRunning() {
    setPlaying(false);
    if (getRunner() != null) {
        getRunner().halt();
        try {
            getRunner().getSource().close();
        } catch (IOException e) {
            Util.uncheckedThrow(e);
        }
    }
}
 
Example 3
Source File: ExecutionModel.java    From clarity with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private void instantiateMissingProcessors() {
    for (Map.Entry<Class<?>, Object> entry : processors.entrySet()) {
        if (entry.getValue() == null) {
            try {
                entry.setValue(entry.getKey().newInstance());
            } catch (Exception e) {
                Util.uncheckedThrow(e);
            }
        }
    }
}
 
Example 4
Source File: ExecutionModel.java    From clarity with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private void bindInvocationPoints(skadistats.clarity.processor.runner.Context context) {
    for (UsagePoint up : usagePoints) {
        if (up instanceof InvocationPoint) {
            try {
                ((InvocationPoint) up).bind(context);
            } catch (IllegalAccessException e) {
                Util.uncheckedThrow(e);
            }
        }
    }
}
 
Example 5
Source File: ExecutionModel.java    From clarity with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private void callInitializers() {
    for (UsagePoint up : usagePoints) {
        if (up instanceof InitializerMethod) {
            continue;
        }
        InitializerMethod im = initializers.get(up.getUsagePointClass());
        if (im != null) {
            try {
                im.invoke(up);
            } catch (Throwable e) {
                Util.uncheckedThrow(e);
            }
        }
    }
}
 
Example 6
Source File: Event.java    From clarity with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public void raise(Object... args){
    for (Set<EventListener<A>> listeners : orderedListeners.values()) {
        for (EventListener<A> listener : listeners) {
            if (listener.isInvokedForArguments(args)) {
                try {
                    listener.invoke(args);
                } catch (Throwable throwable) {
                    Util.uncheckedThrow(throwable);
                }
            }
        }
    }
}
 
Example 7
Source File: BitStream.java    From clarity with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public static BitStream createBitStream(ByteString input) {
    try {
        return bitStreamConstructor.newInstance(input);
    } catch (Exception e) {
        Util.uncheckedThrow(e);
        return null;
    }
}
 
Example 8
Source File: BitStreamImplementations.java    From clarity with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public static Constructor<BitStream> determineConstructor() {
    if (implementation == null) {
        implementation = System.getProperty("os.arch").contains("64") ? 2 : 0;
        implementation += classForName("sun.misc.Unsafe") != null ? 1 : 0;
    }
    try {
        Class<?> implClass = classForName(bitStreamClasses[implementation]);
        return (Constructor<BitStream>) implClass.getDeclaredConstructor(ByteString.class);
    } catch (Exception e) {
        Util.uncheckedThrow(e);
        return null;
    }
}