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

com.fasterxml.storemate.shared.util.WithBytesAsUTF8String Maven / Gradle / Ivy

There is a newer version: 1.1.4
Show newest version
package com.fasterxml.storemate.shared.util;


/**
 * Simple {@link WithBytesCallback} implementation to use when
 * when you need contents to be converted to a UTF-8 String.
 */
public class WithBytesAsUTF8String implements WithBytesCallback
{
   public final static WithBytesAsUTF8String instance = new WithBytesAsUTF8String();

   @Override
   public String withBytes(byte[] buffer, int offset, int length) 
   {
       if (length <= 0) {
           return "";
       }
       return UTF8Encoder.decodeFromUTF8(buffer, offset, length);
   }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy