1package com.android.server.wifi.anqp; 2 3import java.net.ProtocolException; 4import java.nio.ByteBuffer; 5import java.nio.charset.StandardCharsets; 6 7/** 8 * ANQP Element to hold a generic (UTF-8 decoded) character string 9 */ 10public class GenericStringElement extends ANQPElement { 11 private final String mText; 12 13 public GenericStringElement(Constants.ANQPElementType infoID, ByteBuffer payload) throws ProtocolException { 14 super(infoID); 15 mText = Constants.getString(payload, payload.remaining(), StandardCharsets.UTF_8); 16 } 17 18 public String getM_text() { 19 return mText; 20 } 21 22 @Override 23 public String toString() { 24 return "Element ID " + getID() + ": '" + mText + "'"; 25 } 26} 27