class BasenameBuilder {

    static String build(Resource resource) throws IOException{
        Validate.notNull(resource, "resource can't be null!");

        //---------------------------------------------------------------

        URL url = resource.getURL();
        String fileName = url.getFile();

        String afterParseUrl = parseUrl(url, fileName);

        String baseName = parseBasename(afterParseUrl);
        LOGGER.debug("file:[{}],baseName is:[{}]", fileName, baseName);
        return baseName;
    }

}

class BasenameBuilderTest  {

    @Test
    public void test() throws IOException{

        String urlOrPath = "classpath:i18n/help_message_zh_HK.properties";
        Resource resource = ResourceUtil.getResource(urlOrPath);
        String build = BasenameBuilder.build(resource);

        LOGGER.debug(build);
    }

}