您的位置:首页 > 汽车 > 时评 > 公司注册地址要求_网页网络优化_微博营销的特点_推广普通话手抄报一等奖

公司注册地址要求_网页网络优化_微博营销的特点_推广普通话手抄报一等奖

2024/10/18 15:18:47 来源:https://blog.csdn.net/jhgfvjfggff_fds_f/article/details/142935442  浏览:    关键词:公司注册地址要求_网页网络优化_微博营销的特点_推广普通话手抄报一等奖
公司注册地址要求_网页网络优化_微博营销的特点_推广普通话手抄报一等奖

目录

    • 1、导入maven依赖
    • 2、代码案例
    • 3、SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".


1、导入maven依赖

<dependency><groupId>org.mp4parser</groupId><artifactId>isoparser</artifactId><version>1.9.41</version>
</dependency>

2、代码案例

import com.alibaba.fastjson2.JSON;
import org.mp4parser.IsoFile;import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.text.ParseException;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit;
import java.time.temporal.TemporalAdjusters;
import java.util.*;public class Test {public static void main(String[] args) throws ParseException {long spsj = readDuration(Paths.get("C:\\Users\\Administrator\\Desktop\\ceshi.mp4"));System.out.println(spsj);}public static long readDuration(Path mp4Path) {if (Files.notExists(mp4Path) || !Files.isReadable(mp4Path)) {System.out.println("文件路径不存在或不可读 " + mp4Path);return 0;}try {IsoFile isoFile = new IsoFile(mp4Path.toFile());long duration = isoFile.getMovieBox().getMovieHeaderBox().getDuration();long timescale = isoFile.getMovieBox().getMovieHeaderBox().getTimescale();return duration / timescale;} catch (IOException e) {e.printStackTrace();return 0;}}
}

3、SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinder”.

如果在运行过程中报错:SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".

问题分析:
org.slf4j.impl.StaticLoggerBinder通常存在于slf4j-nop.jar和slf4j-simple.jar中,虽然项目maven中已引入了simple包,但依然存在报错。说明simple包未真正被加载。为了让包更好的加载,在依赖中添加type为jar后,问题得到解决。

<!-- 依赖软件版本 -->
<properties><slf4j.version>1.7.30</slf4j.version>
</properties><!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-api -->
<dependency><groupId>org.slf4j</groupId><artifactId>slf4j-api</artifactId><version>${slf4j.version}</version>
</dependency>
<!--         https://mvnrepository.com/artifact/org.slf4j/slf4j-simple-->
<dependency><groupId>org.slf4j</groupId><artifactId>slf4j-simple</artifactId><version>${slf4j.version}</version><!-- 注意,若无type为jar则报错--><type>jar</type>
</dependency>

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com