summaryrefslogtreecommitdiffstats
path: root/service/java/com/android/server/wifi/anqp/GenericStringElement.java
blob: 6cf7b1a49b0d17a9f3d0af4c9702539a187e6fea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package com.android.server.wifi.anqp;

import java.net.ProtocolException;
import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;

/**
 * ANQP Element to hold a generic (UTF-8 decoded) character string
 */
public class GenericStringElement extends ANQPElement {
    private final String mText;

    public GenericStringElement(Constants.ANQPElementType infoID, ByteBuffer payload) throws ProtocolException {
        super(infoID);
        mText = Constants.getString(payload, payload.remaining(), StandardCharsets.UTF_8);
    }

    public String getM_text() {
        return mText;
    }

    @Override
    public String toString() {
        return "Element ID " + getID() + ": '" + mText + "'";
    }
}