最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

SpringBoot + FFmpeg實(shí)現(xiàn)一個(gè)簡單的M3U8切片轉(zhuǎn)碼系統(tǒng)

 更新時(shí)間:2021年05月19日 09:14:04   作者:SpringBoot中文社區(qū)  
使用大名鼎鼎的ffmpeg,把視頻文件切片成m3u8,并且通過springboot,可以實(shí)現(xiàn)在線的點(diǎn)播。

想法

客戶端上傳視頻到服務(wù)器,服務(wù)器對視頻進(jìn)行切片后,返回m3u8,封面等訪問路徑??梢栽诰€的播放。 服務(wù)器可以對視頻做一些簡單的處理,例如裁剪,封面的截取時(shí)間。

視頻轉(zhuǎn)碼文件夾的定義

喜羊羊與灰太狼  // 文件夾名稱就是視頻標(biāo)題
  |-index.m3u8  // 主m3u8文件,里面可以配置多個(gè)碼率的播放地址
  |-poster.jpg  // 截取的封面圖片
  |-ts      // 切片目錄
    |-index.m3u8  // 切片播放索引
    |-key   // 播放需要解密的AES KEY

實(shí)現(xiàn)

需要先在本機(jī)安裝FFmpeg,并且添加到PATH環(huán)境變量,如果不會(huì)先通過搜索引擎找找資料

工程

pom

<project xmlns="http://maven.apache.org/POM/4.0.0"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>com.demo</groupId>
	<artifactId>demo</artifactId>
	<version>0.0.1-SNAPSHOT</version>


	<parent>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</artifactId>
		<version>2.4.5</version>
		<relativePath /> <!-- lookup parent from repository -->
	</parent>

	<dependencies>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-test</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.junit.vintage</groupId>
			<artifactId>junit-vintage-engine</artifactId>
			<scope>test</scope>
		</dependency>

		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-web</artifactId>
			<exclusions>
				<exclusion>
					<groupId>org.springframework.boot</groupId>
					<artifactId>spring-boot-starter-tomcat</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-undertow</artifactId>
		</dependency>
		<dependency>
			<groupId>commons-codec</groupId>
			<artifactId>commons-codec</artifactId>
		</dependency>
		<dependency>
			<groupId>com.google.code.gson</groupId>
			<artifactId>gson</artifactId>
		</dependency>

	</dependencies>

	<build>
		<finalName>${project.artifactId}</finalName>
		<plugins>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
				<configuration>
					<executable>true</executable>
				</configuration>
			</plugin>
		</plugins>
	</build>
</project>

配置文件

server:
  port: 80


app:
  # 存儲(chǔ)轉(zhuǎn)碼視頻的文件夾地址
  video-folder: "C:\\Users\\Administrator\\Desktop\\tmp"

spring:
  servlet:
    multipart:
      enabled: true
      # 不限制文件大小
      max-file-size: -1
      # 不限制請求體大小
      max-request-size: -1
      # 臨時(shí)IO目錄
      location: "${java.io.tmpdir}"
      # 不延遲解析
      resolve-lazily: false
      # 超過1Mb,就IO到臨時(shí)目錄
      file-size-threshold: 1MB
  web:
    resources:
      static-locations:
        - "classpath:/static/"
        - "file:${app.video-folder}" # 把視頻文件夾目錄,添加到靜態(tài)資源目錄列表

TranscodeConfig,用于控制轉(zhuǎn)碼的一些參數(shù)

package com.demo.ffmpeg;

public class TranscodeConfig {
	private String poster;				// 截取封面的時(shí)間			HH:mm:ss.[SSS]
	private String tsSeconds;			// ts分片大小,單位是秒
	private String cutStart;			// 視頻裁剪,開始時(shí)間		HH:mm:ss.[SSS]
	private String cutEnd;				// 視頻裁剪,結(jié)束時(shí)間		HH:mm:ss.[SSS]
	public String getPoster() {
		return poster;
	}

	public void setPoster(String poster) {
		this.poster = poster;
	}

	public String getTsSeconds() {
		return tsSeconds;
	}

	public void setTsSeconds(String tsSeconds) {
		this.tsSeconds = tsSeconds;
	}

	public String getCutStart() {
		return cutStart;
	}

	public void setCutStart(String cutStart) {
		this.cutStart = cutStart;
	}

	public String getCutEnd() {
		return cutEnd;
	}

	public void setCutEnd(String cutEnd) {
		this.cutEnd = cutEnd;
	}

	@Override
	public String toString() {
		return "TranscodeConfig [poster=" + poster + ", tsSeconds=" + tsSeconds + ", cutStart=" + cutStart + ", cutEnd="
				+ cutEnd + "]";
	}
}

MediaInfo,封裝視頻的一些基礎(chǔ)信息

package com.demo.ffmpeg;

import java.util.List;

import com.google.gson.annotations.SerializedName;

public class MediaInfo {
	public static class Format {
		@SerializedName("bit_rate")
		private String bitRate;
		public String getBitRate() {
			return bitRate;
		}
		public void setBitRate(String bitRate) {
			this.bitRate = bitRate;
		}
	}

	public static class Stream {
		@SerializedName("index")
		private int index;

		@SerializedName("codec_name")
		private String codecName;

		@SerializedName("codec_long_name")
		private String codecLongame;

		@SerializedName("profile")
		private String profile;
	}
	
	// ----------------------------------

	@SerializedName("streams")
	private List<Stream> streams;

	@SerializedName("format")
	private Format format;

	public List<Stream> getStreams() {
		return streams;
	}

	public void setStreams(List<Stream> streams) {
		this.streams = streams;
	}

	public Format getFormat() {
		return format;
	}

	public void setFormat(Format format) {
		this.format = format;
	}
}

FFmpegUtils,工具類封裝FFmpeg的一些操作

package com.demo.ffmpeg;

import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.List;

import javax.crypto.KeyGenerator;

import org.apache.commons.codec.binary.Hex;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.StringUtils;

import com.google.gson.Gson;


public class FFmpegUtils {
	
	private static final Logger LOGGER = LoggerFactory.getLogger(FFmpegUtils.class);
	
	
	// 跨平臺換行符
	private static final String LINE_SEPARATOR = System.getProperty("line.separator");
	
	/**
	 * 生成隨機(jī)16個(gè)字節(jié)的AESKEY
	 * @return
	 */
	private static byte[] genAesKey ()  {
		try {
			KeyGenerator keyGenerator = KeyGenerator.getInstance("AES");
			keyGenerator.init(128);
			return keyGenerator.generateKey().getEncoded();
		} catch (NoSuchAlgorithmException e) {
			return null;
		}
	}
	
	/**
	 * 在指定的目錄下生成key_info, key文件,返回key_info文件
	 * @param folder
	 * @throws IOException 
	 */
	private static Path genKeyInfo(String folder) throws IOException {
		// AES 密鑰
		byte[] aesKey = genAesKey();
		// AES 向量
		String iv = Hex.encodeHexString(genAesKey());
		
		// key 文件寫入
		Path keyFile = Paths.get(folder, "key");
		Files.write(keyFile, aesKey, StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING);

		// key_info 文件寫入
		StringBuilder stringBuilder = new StringBuilder();
		stringBuilder.append("key").append(LINE_SEPARATOR);					// m3u8加載key文件網(wǎng)絡(luò)路徑
		stringBuilder.append(keyFile.toString()).append(LINE_SEPARATOR);	// FFmeg加載key_info文件路徑
		stringBuilder.append(iv);											// ASE 向量
		
		Path keyInfo = Paths.get(folder, "key_info");
		
		Files.write(keyInfo, stringBuilder.toString().getBytes(), StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING);
		
		return keyInfo;
	}
	
	/**
	 * 指定的目錄下生成 master index.m3u8 文件
	 * @param fileName			master m3u8文件地址
	 * @param indexPath			訪問子index.m3u8的路徑
	 * @param bandWidth			流碼率
	 * @throws IOException
	 */
	private static void genIndex(String file, String indexPath, String bandWidth) throws IOException {
		StringBuilder stringBuilder = new StringBuilder();
		stringBuilder.append("#EXTM3U").append(LINE_SEPARATOR);
		stringBuilder.append("#EXT-X-STREAM-INF:BANDWIDTH=" + bandWidth).append(LINE_SEPARATOR);  // 碼率
		stringBuilder.append(indexPath);
		Files.write(Paths.get(file), stringBuilder.toString().getBytes(StandardCharsets.UTF_8), StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING);
	}
	
	/**
	 * 轉(zhuǎn)碼視頻為m3u8
	 * @param source				源視頻
	 * @param destFolder			目標(biāo)文件夾
	 * @param config				配置信息
	 * @throws IOException 
	 * @throws InterruptedException 
	 */
	public static void transcodeToM3u8(String source, String destFolder, TranscodeConfig config) throws IOException, InterruptedException {
		
		// 判斷源視頻是否存在
		if (!Files.exists(Paths.get(source))) {
			throw new IllegalArgumentException("文件不存在:" + source);
		}
		
		// 創(chuàng)建工作目錄
		Path workDir = Paths.get(destFolder, "ts");
		Files.createDirectories(workDir);
		
		// 在工作目錄生成KeyInfo文件
		Path keyInfo = genKeyInfo(workDir.toString());
		
		// 構(gòu)建命令
		List<String> commands = new ArrayList<>();
		commands.add("ffmpeg");			
		commands.add("-i")						;commands.add(source);					// 源文件
		commands.add("-c:v")					;commands.add("libx264");				// 視頻編碼為H264
		commands.add("-c:a")					;commands.add("copy");					// 音頻直接copy
		commands.add("-hls_key_info_file")		;commands.add(keyInfo.toString());		// 指定密鑰文件路徑
		commands.add("-hls_time")				;commands.add(config.getTsSeconds());	// ts切片大小
		commands.add("-hls_playlist_type")		;commands.add("vod");					// 點(diǎn)播模式
		commands.add("-hls_segment_filename")	;commands.add("%06d.ts");				// ts切片文件名稱
		
		if (StringUtils.hasText(config.getCutStart())) {
			commands.add("-ss")					;commands.add(config.getCutStart());	// 開始時(shí)間
		}
		if (StringUtils.hasText(config.getCutEnd())) {
			commands.add("-to")					;commands.add(config.getCutEnd());		// 結(jié)束時(shí)間
		}
		commands.add("index.m3u8");														// 生成m3u8文件
		
		// 構(gòu)建進(jìn)程
		Process process = new ProcessBuilder()
			.command(commands)
			.directory(workDir.toFile())
			.start()
			;
		
		// 讀取進(jìn)程標(biāo)準(zhǔn)輸出
		new Thread(() -> {
			try (BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(process.getInputStream()))) {
				String line = null;
				while ((line = bufferedReader.readLine()) != null) {
					LOGGER.info(line);
				}
			} catch (IOException e) {
			}
		}).start();
		
		// 讀取進(jìn)程異常輸出
		new Thread(() -> {
			try (BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(process.getErrorStream()))) {
				String line = null;
				while ((line = bufferedReader.readLine()) != null) {
					LOGGER.info(line);
				}
			} catch (IOException e) {
			}
		}).start();
		
		
		// 阻塞直到任務(wù)結(jié)束
		if (process.waitFor() != 0) {
			throw new RuntimeException("視頻切片異常");
		}
		
		// 切出封面
		if (!screenShots(source, String.join(File.separator, destFolder, "poster.jpg"), config.getPoster())) {
			throw new RuntimeException("封面截取異常");
		}
		
		// 獲取視頻信息
		MediaInfo mediaInfo = getMediaInfo(source);
		if (mediaInfo == null) {
			throw new RuntimeException("獲取媒體信息異常");
		}
		
		// 生成index.m3u8文件
		genIndex(String.join(File.separator, destFolder, "index.m3u8"), "ts/index.m3u8", mediaInfo.getFormat().getBitRate());
		
		// 刪除keyInfo文件
		Files.delete(keyInfo);
	}
	
	/**
	 * 獲取視頻文件的媒體信息
	 * @param source
	 * @return
	 * @throws IOException
	 * @throws InterruptedException
	 */
	public static MediaInfo getMediaInfo(String source) throws IOException, InterruptedException {
		List<String> commands = new ArrayList<>();
		commands.add("ffprobe");	
		commands.add("-i")				;commands.add(source);
		commands.add("-show_format");
		commands.add("-show_streams");
		commands.add("-print_format")	;commands.add("json");
		
		Process process = new ProcessBuilder(commands)
				.start();
		 
		MediaInfo mediaInfo = null;
		
		try (BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(process.getInputStream()))) {
			mediaInfo = new Gson().fromJson(bufferedReader, MediaInfo.class);
		} catch (IOException e) {
			e.printStackTrace();
		}
		
		if (process.waitFor() != 0) {
			return null;
		}
		
		return mediaInfo;
	}
	
	/**
	 * 截取視頻的指定時(shí)間幀,生成圖片文件
	 * @param source		源文件
	 * @param file			圖片文件
	 * @param time			截圖時(shí)間 HH:mm:ss.[SSS]		
	 * @throws IOException 
	 * @throws InterruptedException 
	 */
	public static boolean screenShots(String source, String file, String time) throws IOException, InterruptedException {
		
		List<String> commands = new ArrayList<>();
		commands.add("ffmpeg");	
		commands.add("-i")				;commands.add(source);
		commands.add("-ss")				;commands.add(time);
		commands.add("-y");
		commands.add("-q:v")			;commands.add("1");
		commands.add("-frames:v")		;commands.add("1");
		commands.add("-f");				;commands.add("image2");
		commands.add(file);
		
		Process process = new ProcessBuilder(commands)
					.start();
		
		// 讀取進(jìn)程標(biāo)準(zhǔn)輸出
		new Thread(() -> {
			try (BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(process.getInputStream()))) {
				String line = null;
				while ((line = bufferedReader.readLine()) != null) {
					LOGGER.info(line);
				}
			} catch (IOException e) {
			}
		}).start();
		
		// 讀取進(jìn)程異常輸出
		new Thread(() -> {
			try (BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(process.getErrorStream()))) {
				String line = null;
				while ((line = bufferedReader.readLine()) != null) {
					LOGGER.error(line);
				}
			} catch (IOException e) {
			}
		}).start();
		
		return process.waitFor() == 0;
	}
}


UploadController,執(zhí)行轉(zhuǎn)碼操作

package com.demo.web.controller;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.HashMap;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import com.demo.ffmpeg.FFmpegUtils;
import com.demo.ffmpeg.TranscodeConfig;

@RestController
@RequestMapping("/upload")
public class UploadController {
	
	private static final Logger LOGGER = LoggerFactory.getLogger(UploadController.class);
	
	@Value("${app.video-folder}")
	private String videoFolder;

	private Path tempDir = Paths.get(System.getProperty("java.io.tmpdir"));
	
	/**
	 * 上傳視頻進(jìn)行切片處理,返回訪問路徑
	 * @param video
	 * @param transcodeConfig
	 * @return
	 * @throws IOException 
	 */
	@PostMapping
	public Object upload (@RequestPart(name = "file", required = true) MultipartFile video,
						@RequestPart(name = "config", required = true) TranscodeConfig transcodeConfig) throws IOException {
		
		LOGGER.info("文件信息:title={}, size={}", video.getOriginalFilename(), video.getSize());
		LOGGER.info("轉(zhuǎn)碼配置:{}", transcodeConfig);
		
		// 原始文件名稱,也就是視頻的標(biāo)題
		String title = video.getOriginalFilename();
		
		// io到臨時(shí)文件
		Path tempFile = tempDir.resolve(title);
		LOGGER.info("io到臨時(shí)文件:{}", tempFile.toString());
		
		try {
			
			video.transferTo(tempFile);
			
			// 刪除后綴
			title = title.substring(0, title.lastIndexOf("."));
			
			// 按照日期生成子目錄
			String today = DateTimeFormatter.ofPattern("yyyyMMdd").format(LocalDate.now());
			
			// 嘗試創(chuàng)建視頻目錄
			Path targetFolder = Files.createDirectories(Paths.get(videoFolder, today, title));
			
			LOGGER.info("創(chuàng)建文件夾目錄:{}", targetFolder);
			Files.createDirectories(targetFolder);
			
			// 執(zhí)行轉(zhuǎn)碼操作
			LOGGER.info("開始轉(zhuǎn)碼");
			try {
				FFmpegUtils.transcodeToM3u8(tempFile.toString(), targetFolder.toString(), transcodeConfig);
			} catch (Exception e) {
				LOGGER.error("轉(zhuǎn)碼異常:{}", e.getMessage());
				Map<String, Object> result = new HashMap<>();
				result.put("success", false);
				result.put("message", e.getMessage());
				return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(result);
			}
			
			// 封裝結(jié)果
			Map<String, Object> videoInfo = new HashMap<>();
			videoInfo.put("title", title);
			videoInfo.put("m3u8", String.join("/", "", today, title, "index.m3u8"));
			videoInfo.put("poster", String.join("/", "", today, title, "poster.jpg"));
			
			Map<String, Object> result = new HashMap<>();
			result.put("success", true);
			result.put("data", videoInfo);
			return result;
		} finally {
			// 始終刪除臨時(shí)文件
			Files.delete(tempFile);
		}
	}
}

index.html,客戶端

<html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Title</title>
        <script src="https://cdn.jsdelivr.net/hls.js/latest/hls.min.js"></script>
    </head>
    <body>
        選擇轉(zhuǎn)碼文件: <input name="file" type="file" accept="video/*" onchange="upload(event)">
        <hr/>
		<video id="video"  width="500" height="400" controls="controls"></video>
    </body>
    <script>
    
   		const video = document.getElementById('video');
    	
        function upload (e){
            let files = e.target.files
            if (!files) {
                return
            }
            
            // TODO 轉(zhuǎn)碼配置這里固定死了
            var transCodeConfig = {
            	poster: "00:00:00.001", // 截取第1毫秒作為封面
            	tsSeconds: 15,				
            	cutStart: "",
            	cutEnd: ""
            }
            
            // 執(zhí)行上傳
            let formData = new FormData();
            formData.append("file", files[0])
            formData.append("config", new Blob([JSON.stringify(transCodeConfig)], {type: "application/json; charset=utf-8"}))

            fetch('/upload', {
                method: 'POST',
                body: formData
            })
            .then(resp =>  resp.json())
            .then(message => {
            	if (message.success){
            		// 設(shè)置封面
            		video.poster = message.data.poster;
            		
            		// 渲染到播放器
            		var hls = new Hls();
        		    hls.loadSource(message.data.m3u8);
        		    hls.attachMedia(video);
            	} else {
            		alert("轉(zhuǎn)碼異常,詳情查看控制臺");
            		console.log(message.message);
            	}
            })
            .catch(err => {
            	alert("轉(zhuǎn)碼異常,詳情查看控制臺");
                throw err
            })
        }
    </script>
</html>

使用

  1. 在配置文件中,配置到本地視頻目錄后啟動(dòng)
  2. 打開頁面 localhost
  3. 點(diǎn)擊【選擇文件】,選擇一個(gè)視頻文件進(jìn)行上傳,等待執(zhí)行完畢(沒有做加載動(dòng)畫)
  4. 后端轉(zhuǎn)碼完成后,會(huì)自動(dòng)把視頻信息加載到播放器,此時(shí)可以手動(dòng)點(diǎn)擊播放按鈕進(jìn)行播放

可以打開控制臺,查看上傳進(jìn)度,以及播放時(shí)的網(wǎng)絡(luò)加載信息

以上就是SpringBoot + FFmpeg實(shí)現(xiàn)一個(gè)簡單的M3U8切片轉(zhuǎn)碼系統(tǒng)的詳細(xì)內(nèi)容,更多關(guān)于SpringBoot 實(shí)現(xiàn)M3U8切片轉(zhuǎn)碼的資料請關(guān)注腳本之家其它相關(guān)文章!

相關(guān)文章

  • 使用Java編寫導(dǎo)出不確定行數(shù)列數(shù)數(shù)據(jù)的工具類

    使用Java編寫導(dǎo)出不確定行數(shù)列數(shù)數(shù)據(jù)的工具類

    這篇文章主要為大家詳細(xì)介紹了如何使用Java編寫導(dǎo)出不確定行數(shù)列數(shù)數(shù)據(jù)的工具類,文中的示例代碼講解詳細(xì),感興趣的小伙伴可以跟隨小編一起學(xué)習(xí)一下
    2024-03-03
  • 面試官問如何啟動(dòng)Java?線程

    面試官問如何啟動(dòng)Java?線程

    這篇文章主要介紹了面試官問如何啟動(dòng)Java?線程,Java?的線程創(chuàng)建和啟動(dòng)非常簡單,但如果問一個(gè)線程是怎么啟動(dòng)起來的往往并不清楚,甚至不知道為什么啟動(dòng)時(shí)是調(diào)用start(),而不是調(diào)用run()方法呢?下面我們就一起進(jìn)入文章學(xué)習(xí)這個(gè)問題吧
    2021-12-12
  • mybatis-plus中的Enum用法實(shí)例

    mybatis-plus中的Enum用法實(shí)例

    本文主要介紹了mybatis-plus中的Enum用法實(shí)例,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2023-01-01
  • Java漢字轉(zhuǎn)拼音類庫Pinyin4j詳細(xì)使用方法與實(shí)例

    Java漢字轉(zhuǎn)拼音類庫Pinyin4j詳細(xì)使用方法與實(shí)例

    這篇文章主要介紹了Java漢字轉(zhuǎn)拼音類庫Pinyin4j詳細(xì)使用方法與實(shí)例,需要的朋友可以參考下
    2020-02-02
  • Java使用poi-tl設(shè)置word圖片環(huán)繞方式為浮于在文字上方

    Java使用poi-tl設(shè)置word圖片環(huán)繞方式為浮于在文字上方

    POI-TL 是一個(gè)基于 Apache POI 的 Java 庫,專注于在 Microsoft Word 文檔(.docx 格式)中進(jìn)行模板填充和動(dòng)態(tài)內(nèi)容生成,下面我們看看如何使用poi-tl設(shè)置word圖片環(huán)繞方式為浮于在文字上方吧
    2025-03-03
  • Java線程同步機(jī)制_動(dòng)力節(jié)點(diǎn)Java學(xué)院整理

    Java線程同步機(jī)制_動(dòng)力節(jié)點(diǎn)Java學(xué)院整理

    在之前,已經(jīng)學(xué)習(xí)到了線程的創(chuàng)建和狀態(tài)控制,但是每個(gè)線程之間幾乎都沒有什么太大的聯(lián)系??墒怯械臅r(shí)候,可能存在多個(gè)線程多同一個(gè)數(shù)據(jù)進(jìn)行操作,這樣,可能就會(huì)引用各種奇怪的問題?,F(xiàn)在就來學(xué)習(xí)多線程對數(shù)據(jù)訪問的控制吧
    2017-05-05
  • Java中Socket實(shí)現(xiàn)數(shù)據(jù)通信的示例代碼

    Java中Socket實(shí)現(xiàn)數(shù)據(jù)通信的示例代碼

    本文主要介紹了Java中Socket實(shí)現(xiàn)數(shù)據(jù)通信的示例代碼,Socket可以建立起客戶端和服務(wù)器之間的連接,實(shí)現(xiàn)數(shù)據(jù)的傳輸和交互,感興趣的可以了解一下
    2023-09-09
  • 詳解Junit 測試之 Spring Test

    詳解Junit 測試之 Spring Test

    本篇文章主要介紹了Junit 測試之 Spring Test,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧
    2017-10-10
  • 老生常談比較排序之堆排序

    老生常談比較排序之堆排序

    下面小編就為大家?guī)硪黄仙U劚容^排序之堆排序。小編覺得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧
    2017-06-06
  • 關(guān)于SpringCloud的微服務(wù)以及組件詳解

    關(guān)于SpringCloud的微服務(wù)以及組件詳解

    這篇文章主要介紹了關(guān)于SpringCloud的微服務(wù)以及組件詳解,是一個(gè)更高層次的、 架構(gòu)視角的綜合性大型項(xiàng)目, 他的目標(biāo)是構(gòu)建一套標(biāo)準(zhǔn)化的微服務(wù)解決方案,需要的朋友可以參考下
    2023-05-05

最新評論

邵东县| 寻乌县| 天镇县| 巴东县| 金平| 左贡县| 临江市| 左权县| 师宗县| 舟曲县| 锡林郭勒盟| 淳化县| 察雅县| 建德市| 英山县| 古田县| 东阿县| 通州市| 望都县| 鹤山市| 军事| 丹巴县| 松原市| 黄石市| 吉水县| 江油市| 苗栗县| 杭州市| 建瓯市| 德清县| 澄迈县| 西林县| 扎兰屯市| 合山市| 阿拉尔市| 正蓝旗| 甘南县| 江津市| 安溪县| 穆棱市| 自治县|