fuzhengwei / fuzhengwei/blog.github.io

netty案例,netty4.1中级拓展篇四《Netty传输文件、分片发送、断点续传》 - bugstack虫洞栈

Open
#74 1 comment 0 reactions 0 assignees View on GitHub
86111e730557c643252fb73d5b80b2c1 gitment
Dominant language
HTML
Stars
14
Forks
7
PR merge metrics
No merged PRs in 30d

Description

https://fuzhengwei.github.io/itstack-demo-netty-2/2019/08/19/netty%E6%A1%88%E4%BE%8B-netty4.1%E4%B8%AD%E7%BA%A7%E6%8B%93%E5%B1%95%E7%AF%87%E5%9B%9B-Netty%E4%BC%A0%E8%BE%93%E6%96%87%E4%BB%B6-%E5%88%86%E7%89%87%E5%8F%91%E9%80%81-%E6%96%AD%E7%82%B9%E7%BB%AD%E4%BC%A0.html

前言介绍


1、在实际应用中我们经常使用到网盘服务,他们可以高效的上传下载较大文件。那么这些高性能文件传输服务,都需要实现的分片发送、断点续传功能。
2、在Java文件操作中有RandomAccessFile类,他可以支持文件的定位读取和写入,这样就满足了我们对文件分片的最基础需求。
3、Netty服务端启动后,可以向客户端发送文件传输指令;允许接收文件、控制读取位点、记录传输标记、文件接收完成。
4、为了保证传输性能我们采用protostuff二进制流进行传输。
5、读取文件的时候需要注意,我们设定byte[1024]为默认读取范围,但当读取到最后的时候可能不足1024个字节,就会出现空字节。这个时候需要去掉空字节,否则我们的文件写入会多额外信息,导致文件不能打开{zip、war、exe、jar等}。

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the linked Netty 4.1 article and its file-transfer, chunking, and resume examples. The payload names no repository file, test, or specific failure, so first reproduce and identify the defect described by the issue. The work is done when the defect is clearly documented and the relevant example or article is corrected.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
documentation, networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.