Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/widget/android/   (Browser von der Mozilla Stiftung Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 1 kB image not shown  

Quelle  Base64UtilsSupport.h   Sprache: C

 
/* -*- Mode: c++; c-basic-offset: 2; tab-width: 20; indent-tabs-mode: nil; -*-
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */


#ifndef Base64UtilsSupport_h__
#define Base64UtilsSupport_h__

#include "mozilla/Base64.h"
#include "mozilla/java/Base64UtilsNatives.h"

namespace mozilla {
namespace widget {

class Base64UtilsSupport final
    : public java::Base64Utils::Natives<Base64UtilsSupport> {
 public:
  static jni::ByteArray::LocalRef Decode(jni::String::Param data) {
    if (!data) {
      return nullptr;
    }

    FallibleTArray<uint8_t> bytes;
    if (NS_FAILED(Base64URLDecode(
            data->ToCString(), Base64URLDecodePaddingPolicy::Ignore, bytes))) {
      return nullptr;
    }

    return jni::ByteArray::New((const signed char*)bytes.Elements(),
                               bytes.Length());
  }

  static jni::String::LocalRef Encode(jni::ByteArray::Param data) {
    if (!data) {
      return nullptr;
    }

    nsTArray<int8_t> bytes = data->GetElements();
    nsCString result;
    if (NS_FAILED(
            Base64URLEncode(data->Length(), (const uint8_t*)bytes.Elements(),
                            Base64URLEncodePaddingPolicy::Omit, result))) {
      return nullptr;
    }
    return jni::StringParam(result);
  }
};

}  // namespace widget
}  // namespace mozilla

#endif  // Base64UtilsSupport_h__

100%


¤ Dauer der Verarbeitung: 0.14 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung ist noch experimentell.