Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import java.io.UnsupportedEncodingException;

public class Main {
    static String ENCODING = "utf-8";

    public static String getContent(byte[] text, int offset) {
        if (text == null) {
            return null;
        }
        try {
            int len = text[offset];
            return new String(text, offset + 1, len, ENCODING);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        return "";
    }
}