text: //
  //  NSData+Encode.h
  //  MYKitDemo
  //
  //  Created by sunjinshuai on 2017/9/8.
  //  Copyright © 2017年 com.51fanxing. All rights reserved.
  //
  
  #import <Foundation/Foundation.h>
  
  NS_ASSUME_NONNULL_BEGIN
  
  @interface NSData (Encode)
  
  /**
   Returns string decoded in UTF8.
   */
  - (nullable NSString *)utf8String;
  
  /**
   Returns a uppercase NSString in HEX.
   */
  - (nullable NSString *)hexString;
  
  /**
   Returns an NSData from hex string.
   
   @param hexString   The hex string which is case insensitive.
   
   @return a new NSData, or nil if an error occurs.
   */
  + (nullable NSData *)dataWithHexString:(NSString *)hexString;
  
  /**
   Returns an NSString for base64 encoded.
   */
  - (nullable NSString *)base64EncodedString;
  
  /**
   Returns an NSData from base64 encoded string.
   
   @warning This method has been implemented in iOS7.
   
   @param base64EncodedString  The encoded string.
   */
  + (nullable NSData *)dataWithBase64EncodedString:(NSString *)base64EncodedString;
  
  /**
   Returns an NSDictionary or NSArray for decoded self.
   Returns nil if an error occurs.
   */
  - (nullable id)jsonValueDecoded;
  
  @end
  
  NS_ASSUME_NONNULL_END
  