新网创想网站建设,新征程启航
为企业提供网站建设、域名注册、服务器等服务
javacv基于ffmpeg和opencv等开源音视频、图像处理库,可以支持各种协议的推流,拉流,实时图像处理,javacv可以解决你的问题,具体请参考javacv教程专栏:网页链接
我们提供的服务有:网站设计制作、成都做网站、微信公众号开发、网站优化、网站认证、宣州ssl等。为近1000家企事业单位解决了网站和推广的问题。提供周到的售前咨询和贴心的售后服务,是有科学管理、有技术的宣州网站制作公司
只要自己的电脑安装了jdk环境,任何地方都可以进行java代码的编写的,记事本也可以。
推流工具OBS Studio
首先在网上下载该工具.然后安装.然后按照如下步骤操作
打开软件点击设置
然后按照如下顺序,先点击串流--服务选择自定义--填写流服务地址
点击下面的加号,选择你想推到服务器的视频文件
然后点击推流,致此就行了
拉流软件VLC media player
首先下载该软件,并打开.
点击媒体,然后选择打开网络串流,填写流服务地址,点击播放.支持刚才推到流服务上的视频,就可以在这里播放了简单的
如无法正常展示请点击“”一键反馈“
内容不错,鼓励一下~
项目结构如下:
代码如下
package main;
public class Course {
private String classNum;
private String credit;
private String startClassDate;
private String endClassDate;
private String teacher;
private String assessment;
public String getClassNum() {
return classNum;
}
public void setClassNum(String classNum) {
this.classNum = classNum;
}
public String getCredit() {
return credit;
}
public void setCredit(String credit) {
this.credit = credit;
}
public String getStartClassDate() {
return startClassDate;
}
public void setStartClassDate(String startClassDate) {
this.startClassDate = startClassDate;
}
public String getEndClassDate() {
return endClassDate;
}
public void setEndClassDate(String endClassDate) {
this.endClassDate = endClassDate;
}
public String getTeacher() {
return teacher;
}
public void setTeacher(String teacher) {
this.teacher = teacher;
}
public String getAssessment() {
return assessment;
}
public void setAssessment(String assessment) {
this.assessment = assessment;
}
@Override
public String toString() {
return " 课程号:" + classNum + ", 学分:" + credit
+ ", 上课时间:" + startClassDate + ", 下课时间:"
+ endClassDate + ", 教师:" + teacher + ", 考核方式:"
+ assessment + "";
}
}
package main;
import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
System.out.println("创建学生请输入姓名:");
Student stu1 = new Student();
stu1.setName(sc.nextLine());
Scanner sc1 = new Scanner(System.in);
System.out.println("创建学生请输入学号:");
stu1.setNumber(sc1.nextLine());
System.out.println("请选择课程,课程如下:");
ListCourse list2 = new ArrayListCourse();
stu1.setCourses(list2);
ListCourse list = readTxt();
for (Course course : list) {
System.out.println(course.toString());
}
for (int i = 1; i 5; i++) {
System.out.println("请输入第"+i+"个课程号:");
//输入第一个课程号
list2 = handleClass(list, list2);
System.err.println("已选择成功!");
list = notSelectClass(list, list2);
System.out.println("请选择课程,课程如下:");
if(i==4){
break;
}
for (Course course : list) {
System.out.println(course.toString());
}
}
System.out.println("课程已选完!结果如下:");
System.err.println("学生:"+stu1.getName()+":");
for (Course course : list2) {
System.err.println(course.toString());
}
}
/**
*
* 查看未选择可选课程
* @param list 全部可选课程
* @param list2 已选课程
* @return
*/
private static ListCourse notSelectClass(ListCourse list,ListCourse list2){
for (int i = 0; i list.size(); i++) {
for (Course course : list2) {
//把已选课程剔除
if(course.getClassNum().equals(list.get(i).getClassNum())){
list.remove(i);
continue;
}
//把时间重合课程剔除 startdate1 =enddate2 and enddate1=startdate2
if(daYuDengYu(course.getEndClassDate(),list.get(i).getStartClassDate())daYuDengYu(list.get(i).getEndClassDate(), course.getStartClassDate())){
list.remove(i);
}
}
}
return list;
}
public static boolean daYuDengYu(String first, String second){
BigDecimal bd1 = new BigDecimal(first);
BigDecimal bd2 = new BigDecimal(second);
return bd1点抗 pareTo(bd2)=0?true:false;
}
/**
* 处理选择课程
* @param list
* @param list2
* @return
*/
private static ListCourse handleClass(ListCourse list,ListCourse list2){
while (true) {
Scanner sssi = new Scanner(System.in);
String num = sssi.nextLine().trim();
for (Course course : list) {
if(num.equals(course.getClassNum())){
list2.add(course);
return list2;
}
}
System.out.println("课程号输入错误,请重新输入:");
}
}
/**
* 读取txt获取课程 每个课程按;分割每个属性按,分割
* @return
* @throws Exception
*/
private static ListCourse readTxt() throws Exception{
/* 读入TXT文件 */
String pathname = Main.class.getResource("/").toString();
pathname = pathname.substring(6, pathname.length()-4)+"/src/classs/class.txt"; //获取绝对路径
File filename = new File(pathname); // 要读取以上路径的txt文件
ListCourse list = new ArrayListCourse();
BufferedInputStream bis = new BufferedInputStream(new FileInputStream(filename));
//读取文件内容
byte[] b = new byte[bis.available()];
bis.read(b);
if(b!=null){
String [] strs= new String(b).split(";");
if (strs==null) {
return null;
}
for (String string : strs) {
String[] str = string.split(",");
Course course = new Course();
course.setAssessment(str[5].trim());
course.setClassNum(str[0].trim());
course.setCredit(str[1].trim());
course.setEndClassDate(str[3].trim());
course.setStartClassDate(str[2].trim());
course.setTeacher(str[4].trim());
list.add(course);
}
}
bis.close();//关闭流(关闭bis就可以了)
return list;
}
}
package main;
import java.util.List;
public class Student {
private String name;
private String number;
private ListCourse courses;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getNumber() {
return number;
}
public void setNumber(String number) {
this.number = number;
}
public ListCourse getCourses() {
return courses;
}
public void setCourses(ListCourse courses) {
this.courses = courses;
}
}
001,1,7,8,Joyce,assignment;
002,1,8,9,Joyce,assignment;
003,1,12,15,Joyce,assignment;
004,1,18,19,Joyce,assignment;
005,1,7,8,LI,assignment;
006,1,8,9,LI,assignment;
007,1,12,15,LI,assignment;
008,1,18,19,LI,assignment;