Tabnine Logo
Watermarker
Code IndexAdd Tabnine to your IDE (free)

How to use
Watermarker
in
me.itzsomebody.radon.transformers.miscellaneous.watermarker

Best Java code snippets using me.itzsomebody.radon.transformers.miscellaneous.watermarker.Watermarker (Showing top 5 results out of 315)

origin: ItzSomebody/Radon

/**
 * Creates an {@link Watermarker} transformer setup accordingly to the information provided in this
 * {@link WatermarkingTab}.
 *
 * @return an {@link Watermarker} transformer setup accordingly to the information provided in this
 * {@link WatermarkingTab}.
 */
public Watermarker getWatermarker() {
  return (watermarkerEnabledCheckBox.isSelected())
      ? new Watermarker(new WatermarkerSetup(watermarkMessageField.getText(),
      watermarkKeyField.getText())) : null;
}
origin: ItzSomebody/Radon

  /**
   * Sets the tab settings accordingly with the provided {@link SessionInfo}.
   *
   * @param info the {@link SessionInfo} used to determine the tab setup.
   */
  public void setSettings(SessionInfo info) {
    watermarkerEnabledCheckBox.setSelected(false);
    watermarkMessageField.setText(null);
    watermarkMessageField.setEditable(false);
    watermarkKeyField.setText(null);
    watermarkKeyField.setEditable(false);

    if (info.getTransformers() != null) {
      info.getTransformers().stream().filter(transformer ->
          transformer instanceof Watermarker).forEach(transformer -> {
        watermarkerEnabledCheckBox.setSelected(true);
        watermarkMessageField.setEditable(true);
        watermarkKeyField.setEditable(true);

        WatermarkerSetup setup = ((Watermarker) transformer).getSetup();

        watermarkMessageField.setText(setup.getMessage());
        watermarkKeyField.setText(setup.getKey());
      });
    }
  }
}
origin: ItzSomebody/Radon

@Override
public void transform() {
  ArrayList<ClassWrapper> classWrappers = new ArrayList<>(this.getClassWrappers());
  for (int i = 0; i < 3; i++) { // Two extra injections helps with reliability of watermark to be extracted
    Stack<Character> watermark = cipheredWatermark();
    while (!watermark.isEmpty()) {
      ClassWrapper classWrapper;
      int counter = 0;
      do {
        classWrapper = classWrappers.get(RandomUtils.getRandomInt(0, classWrappers.size()));
        counter++;
        if (counter > 20)
          throw new RuntimeException("Radon couldn't find any methods to embed a watermark in after " + counter + "tries.");
      } while (classWrapper.classNode.methods.size() != 0);
      MethodNode methodNode = classWrapper.classNode.methods.get(RandomUtils.getRandomInt(0,
          classWrapper.classNode.methods.size()));
      if (hasInstructions(methodNode)) {
        methodNode.instructions.insertBefore(methodNode.instructions.getFirst(),
            createInstructions(watermark, methodNode));
      }
    }
  }
  LoggerUtils.stdOut("Successfully embedded watermark.");
}
origin: ItzSomebody/Radon

private Watermarker getWatermarkerTransformer() {
  Object o = map.get(ConfigurationSettings.WATERMARK.getValue());
  if (o == null)
    return null;
  if (!(o instanceof Map))
    throw new IllegalConfigurationValueException(ConfigurationSettings.WATERMARK.getValue(), Map.class,
        o.getClass());
  try {
    Map<String, Object> settings = (Map) o;
    if (!(Boolean) settings.get("Enabled"))
      return null;
    String message = (String) settings.get("Message");
    String key = (String) settings.get("Key");
    return new Watermarker(new WatermarkerSetup(message, key));
  } catch (ClassCastException e) {
    throw new IllegalConfigurationValueException("Error while parsing watermark setup: " + e.getMessage());
  }
}
origin: ItzSomebody/Radon

    new LinkedHashMap<String, Object>());
((LinkedHashMap) documentMap.get(ConfigurationSettings.WATERMARK.getValue())).put("Enabled", true);
if (watermarker.getSetup().getMessage() != null)
  ((LinkedHashMap) documentMap.get(ConfigurationSettings.WATERMARK.getValue()))
      .put("Message", watermarker.getSetup().getMessage());
if (watermarker.getSetup().getKey() != null)
  ((LinkedHashMap) documentMap.get(ConfigurationSettings.WATERMARK.getValue()))
      .put("Key", watermarker.getSetup().getKey());
me.itzsomebody.radon.transformers.miscellaneous.watermarkerWatermarker

Javadoc

Embeds a watermark into random classes.

Most used methods

  • <init>
  • getSetup
  • cipheredWatermark
  • createInstructions
  • getClassWrappers
  • hasInstructions

Popular in Java

  • Making http post requests using okhttp
  • scheduleAtFixedRate (Timer)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • getSupportFragmentManager (FragmentActivity)
  • Container (java.awt)
    A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
  • BufferedInputStream (java.io)
    A BufferedInputStream adds functionality to another input stream-namely, the ability to buffer the i
  • FileWriter (java.io)
    A specialized Writer that writes to a file in the file system. All write requests made by calling me
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • JButton (javax.swing)
  • IOUtils (org.apache.commons.io)
    General IO stream manipulation utilities. This class provides static utility methods for input/outpu
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now