Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-WIC-Cnf
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
3
Issues
3
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
CommunityXG
OpenXG-WIC-Cnf
Commits
b42b9fdd
Commit
b42b9fdd
authored
Dec 04, 2020
by
ymwang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
按照碎片数据量的大小排序
parent
792c1643
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
1 deletion
+21
-1
apps/cnf-distributed-business-computing/dbc-business-client/src/main/java/top/ninwoo/dbc/client/service/FileService.java
.../main/java/top/ninwoo/dbc/client/service/FileService.java
+7
-1
apps/cnf-distributed-business-computing/dbc-business-utils/src/main/java/top/ninwoo/dbc/utils/FileServiceImplement.java
.../main/java/top/ninwoo/dbc/utils/FileServiceImplement.java
+14
-0
No files found.
apps/cnf-distributed-business-computing/dbc-business-client/src/main/java/top/ninwoo/dbc/client/service/FileService.java
View file @
b42b9fdd
...
@@ -219,7 +219,7 @@ public class FileService{
...
@@ -219,7 +219,7 @@ public class FileService{
}
}
}
}
//给List集合里的元素进行排序
//给List集合里的元素进行排序
,便于图片正常恢复
public
List
<
FileSlice
>
sortList
(
List
<
FileSlice
>
list
){
public
List
<
FileSlice
>
sortList
(
List
<
FileSlice
>
list
){
//List<FileSlice> list = new ArrayList<FileSlice>();
//List<FileSlice> list = new ArrayList<FileSlice>();
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
...
@@ -237,6 +237,12 @@ public class FileService{
...
@@ -237,6 +237,12 @@ public class FileService{
return
list
;
return
list
;
}
}
//对分割后得到的碎片List按照碎片的大小进行排序---使用冒泡排序
/* public SplitResult sortSpiltList(){
return null;
}*/
public
void
saveFile
(
String
fileName
,
MergeResult
mergeResult
)
{
public
void
saveFile
(
String
fileName
,
MergeResult
mergeResult
)
{
BufferedImage
images
=
mergeResult
.
getImages
();
BufferedImage
images
=
mergeResult
.
getImages
();
//输出拼接后的图像
//输出拼接后的图像
...
...
apps/cnf-distributed-business-computing/dbc-business-utils/src/main/java/top/ninwoo/dbc/utils/FileServiceImplement.java
View file @
b42b9fdd
...
@@ -34,6 +34,20 @@ public class FileServiceImplement implements DistributedComService {
...
@@ -34,6 +34,20 @@ public class FileServiceImplement implements DistributedComService {
fileSlice
.
setFileBytes
(
byteList
.
get
(
i
));
//文件的比特数据
fileSlice
.
setFileBytes
(
byteList
.
get
(
i
));
//文件的比特数据
fileSliceList
.
add
(
fileSlice
);
fileSliceList
.
add
(
fileSlice
);
}
}
//对分割后的碎片,按照其数据量大小排序
for
(
int
i
=
0
;
i
<
fileSliceList
.
size
()-
1
;
i
++)
{
for
(
int
j
=
0
;
j
<
fileSliceList
.
size
()-
i
-
1
;
j
++)
{
if
(
fileSliceList
.
get
(
j
).
getFileBytes
().
length
<
fileSliceList
.
get
(
j
+
1
).
getFileBytes
().
length
)
{
/* int temp = fileSliceList.get(j).getSliceId();
nums[j] = nums[j+1];
nums[j+1] = temp;*/
fileSliceList
.
set
(
j
,
fileSliceList
.
get
(
j
+
1
));
fileSliceList
.
set
(
j
+
1
,
fileSliceList
.
get
(
j
));
}
}
}
SplitResult
splitResult
=
new
SplitResult
();
SplitResult
splitResult
=
new
SplitResult
();
splitResult
.
setFileSliceList
(
fileSliceList
);
splitResult
.
setFileSliceList
(
fileSliceList
);
return
splitResult
;
return
splitResult
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment