congrats Icon
New! Announcing our next generation AI code completions
Read here
Tabnine Logo
Streams.copyToStringFromClasspath
Code IndexAdd Tabnine to your IDE (free)

How to use
copyToStringFromClasspath
method
in
org.elasticsearch.common.io.Streams

Best Java code snippets using org.elasticsearch.common.io.Streams.copyToStringFromClasspath (Showing top 3 results out of 315)

origin: richardwilly98/elasticsearch-river-mongodb

public static String getRiverVersion() {
  String version = "Undefined";
  try {
    String properties = Streams.copyToStringFromClasspath("/org/elasticsearch/river/mongodb/es-build.properties");
    Properties props = new Properties();
    props.load(new FastStringReader(properties));
    String ver = props.getProperty("version", "undefined");
    String hash = props.getProperty("hash", "undefined");
    if (!"undefined".equals(hash)) {
      hash = hash.substring(0, 7);
    }
    String timestamp = "undefined";
    String gitTimestampRaw = props.getProperty("timestamp");
    if (gitTimestampRaw != null) {
      timestamp = ISODateTimeFormat.dateTimeNoMillis().withZone(DateTimeZone.UTC).print(Long.parseLong(gitTimestampRaw));
    }
    version = String.format("version[%s] - hash[%s] - time[%s]", ver, hash, timestamp);
  } catch (Exception ex) {
  }
  return version;
}
origin: com.github.tlrx/elasticsearch-test

  @Override
  public String toString() {
    try {
      if (klass != null) {
        InputStream inputStream = klass.getResourceAsStream(path);
        if (inputStream == null) {
          throw new FileNotFoundException("Resource [" + path + "] not found in classpath with class  [" + klass.getName() + "]");
        }
        return Streams.copyToString(new InputStreamReader(inputStream, "UTF-8"));
      } else {
        return Streams.copyToStringFromClasspath(classLoader, path);
      }
    } catch (IOException e) {
      throw new EsSetupRuntimeException(e);
    }
  }
}
origin: tlrx/elasticsearch-test

  @Override
  public String toString() {
    try {
      if (klass != null) {
        InputStream inputStream = klass.getResourceAsStream(path);
        if (inputStream == null) {
          throw new FileNotFoundException("Resource [" + path + "] not found in classpath with class  [" + klass.getName() + "]");
        }
        return Streams.copyToString(new InputStreamReader(inputStream, "UTF-8"));
      } else {
        return Streams.copyToStringFromClasspath(classLoader, path);
      }
    } catch (IOException e) {
      throw new EsSetupRuntimeException(e);
    }
  }
}
org.elasticsearch.common.ioStreamscopyToStringFromClasspath

Popular methods of Streams

  • copyToString
    Copy the contents of the given Reader into a String. Closes the reader when done.
  • copy
    Copy the contents of the given byte array to the given OutputStream. Closes the stream when done.
  • copyToByteArray
  • readAllLines
  • readFully
  • flushOnCloseStream
    Wraps the given BytesStream in a StreamOutput that simply flushes when close is called.

Popular in Java

  • Updating database using SQL prepared statement
  • requestLocationUpdates (LocationManager)
  • scheduleAtFixedRate (Timer)
  • getExternalFilesDir (Context)
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • HashSet (java.util)
    HashSet is an implementation of a Set. All optional operations (adding and removing) are supported.
  • TimeUnit (java.util.concurrent)
    A TimeUnit represents time durations at a given unit of granularity and provides utility methods to
  • Stream (java.util.stream)
    A sequence of elements supporting sequential and parallel aggregate operations. The following exampl
  • Loader (org.hibernate.loader)
    Abstract superclass of object loading (and querying) strategies. This class implements useful common
  • Table (org.hibernate.mapping)
    A relational table
  • Top 25 Plugins for Webstorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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