congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
CredentialsReader.decode
Code IndexAdd Tabnine to your IDE (free)

How to use
decode
method
in
org.eclipse.leshan.core.credentials.CredentialsReader

Best Java code snippets using org.eclipse.leshan.core.credentials.CredentialsReader.decode (Showing top 5 results out of 315)

origin: eclipse/leshan

/**
 * Read credential from resource (in a jar, war, ...)
 * 
 * @see java.lang.ClassLoader#getResourceAsStream(String)
 */
public T readFromResource(String resourcePath) throws IOException, GeneralSecurityException {
  try (InputStream in = ClassLoader.getSystemResourceAsStream(resourcePath)) {
    return decode(in);
  }
}
origin: eclipse/leshan

/**
 * Decode credential from byte array.
 */
public T decode(byte[] bytes) throws IOException, GeneralSecurityException {
  try (ByteArrayInputStream in = new ByteArrayInputStream(bytes)) {
    return decode(in);
  }
}
origin: eclipse/leshan

/**
 * Read credential from file
 */
public T readFromFile(String fileName) throws IOException, GeneralSecurityException {
  byte[] bytes = Files.readAllBytes(Paths.get(fileName));
  return decode(bytes);
}
origin: eclipse/leshan

  /**
   * Decode credential from an InputStream.
   */
  public T decode(InputStream in) throws IOException, GeneralSecurityException {
    try (ByteArrayOutputStream buffer = new ByteArrayOutputStream()) {
      int nRead;
      byte[] data = new byte[1024];
      while ((nRead = in.read(data, 0, data.length)) != -1) {
        buffer.write(data, 0, nRead);
      }
      buffer.flush();

      return decode(buffer.toByteArray());
    }
  }
}
origin: eclipse/leshan

try {
  SecurityInfo securityInfo = SecurityInfo.newRawPublicKeyInfo(endpoint,
      SecurityUtil.publicKey.decode(value.publicKeyOrId));
  return Arrays.asList(securityInfo);
} catch (IOException | GeneralSecurityException e) {
org.eclipse.leshan.core.credentialsCredentialsReaderdecode

Javadoc

Decode credential from an InputStream.

Popular methods of CredentialsReader

  • readFromResource
    Read credential from resource (in a jar, war, ...)
  • readFromFile
    Read credential from file

Popular in Java

  • Parsing JSON documents to java classes using gson
  • setScale (BigDecimal)
  • getResourceAsStream (ClassLoader)
  • startActivity (Activity)
  • Socket (java.net)
    Provides a client-side TCP socket.
  • Locale (java.util)
    Locale represents a language/country/variant combination. Locales are used to alter the presentatio
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • BoxLayout (javax.swing)
  • Table (org.hibernate.mapping)
    A relational table
  • Sublime Text for Python
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