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

org.scribe.services.Base64Encoder Maven / Gradle / Ivy

There is a newer version: 2024.11.18751.20241128T090041Z-241100
Show newest version
package org.scribe.services;

public abstract class Base64Encoder
{
  private static Base64Encoder instance;

  public static synchronized Base64Encoder getInstance()
  {
    if (instance == null)
    {
      instance = createEncoderInstance();
    }
    return instance;
  }

  private static Base64Encoder createEncoderInstance()
  {
    if (CommonsEncoder.isPresent())
    {
      return new CommonsEncoder();
    }
    else
    {
      return new DatatypeConverterEncoder();
    }
  }

  public static String type()
  {
    return getInstance().getType();
  }

  public abstract String encode(byte[] bytes);

  public abstract String getType();
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy