Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    private static String readEncoding(String contentEncoding, String contentType, String fallback) {
        String encoding = fallback;
        String[] values = contentType.split(";");
        if (contentEncoding != null) {
            encoding = contentEncoding;
        } else {
            for (String value : values) {
                value = value.trim();
                if (value.toLowerCase().startsWith("charset=")) {
                    encoding = value.substring("charset=".length());
                }
            }
        }
        return encoding;
    }
}