All Downloads are FREE. Search and download functionalities are using the official Maven repository.

technology.dice.dicewhere.downloader.picocli.ResourceVersionProvider Maven / Gradle / Ivy

The newest version!
package technology.dice.dicewhere.downloader.picocli;

import java.io.InputStream;
import java.util.Scanner;
import picocli.CommandLine.IVersionProvider;

public class ResourceVersionProvider implements IVersionProvider {

  @Override
  public String[] getVersion() throws Exception {
    try (InputStream is = ResourceVersionProvider.class.getResourceAsStream("/version")) {
      if (is == null) {
        return new String[] {"Unknown version"};
      }
      final Scanner scanner = new Scanner(is).useDelimiter("\\A");
      String version = scanner.next();
      return new String[] {version};
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy