File tree Expand file tree Collapse file tree 12 files changed +26
-22
lines changed
src/main/java/com/dingtalk/open/app/api/util
app-stream-network-rsocket Expand file tree Collapse file tree 12 files changed +26
-22
lines changed Original file line number Diff line number Diff line change 55 <parent >
66 <artifactId >open-app-stream-client</artifactId >
77 <groupId >com.dingtalk.open</groupId >
8- <version >1.3.6 </version >
8+ <version >1.3.7 </version >
99 <relativePath >../pom.xml</relativePath >
1010 </parent >
1111 <modelVersion >4.0.0</modelVersion >
Original file line number Diff line number Diff line change 11package com .dingtalk .open .app .api .util ;
22
3+ import java .io .ByteArrayOutputStream ;
34import java .io .InputStream ;
45
56/**
67 * @author feiyin
78 * @date 2023/3/1
89 */
910public class IoUtils {
10- public static byte [] readAll (InputStream stream ) throws Exception {
11- if (stream == null ) {
11+ private static final int EOF = -1 ;
12+ private static final int BUFFER_SIZE = 4 * 1024 ;
13+
14+ public static byte [] readAll (InputStream input ) throws Exception {
15+ if (input == null ) {
1216 return null ;
1317 }
14- int count = stream . available ( );
15- byte [] content = new byte [count ];
16- while ( count > 0 ) {
17- int readBytes = stream .read (content );
18- count -= readBytes ;
18+ ByteArrayOutputStream output = new ByteArrayOutputStream ( 1024 );
19+ byte [] buffer = new byte [BUFFER_SIZE ];
20+ int n ;
21+ while ( EOF != ( n = input .read (buffer ))) {
22+ output . write ( buffer , 0 , n ) ;
1923 }
20- return content ;
24+ return output . toByteArray () ;
2125 }
2226}
Original file line number Diff line number Diff line change 44 <parent >
55 <groupId >com.dingtalk.open</groupId >
66 <artifactId >open-app-stream-client</artifactId >
7- <version >1.3.6 </version >
7+ <version >1.3.7 </version >
88 <relativePath >../pom.xml</relativePath >
99 </parent >
1010
1111 <artifactId >app-stream-client</artifactId >
1212 <packaging >jar</packaging >
13- <version >1.3.6 </version >
13+ <version >1.3.7 </version >
1414 <name >app-stream-client</name >
1515
1616 <dependencies >
Original file line number Diff line number Diff line change 44 <parent >
55 <groupId >com.dingtalk.open</groupId >
66 <artifactId >app-stream-network</artifactId >
7- <version >1.3.6 </version >
7+ <version >1.3.7 </version >
88 <relativePath >../pom.xml</relativePath >
99 </parent >
1010
1111 <artifactId >app-stream-network-api</artifactId >
12- <version >1.3.6 </version >
12+ <version >1.3.7 </version >
1313 <packaging >jar</packaging >
1414
1515 <name >app-stream-network-api</name >
Original file line number Diff line number Diff line change 44 <parent >
55 <groupId >com.dingtalk.open</groupId >
66 <artifactId >app-stream-network</artifactId >
7- <version >1.3.6 </version >
7+ <version >1.3.7 </version >
88 <relativePath >../pom.xml</relativePath >
99 </parent >
1010
Original file line number Diff line number Diff line change 44 <parent >
55 <groupId >com.dingtalk.open</groupId >
66 <artifactId >app-stream-network</artifactId >
7- <version >1.3.6 </version >
7+ <version >1.3.7 </version >
88 <relativePath >../pom.xml</relativePath >
99 </parent >
1010
Original file line number Diff line number Diff line change 44 <parent >
55 <groupId >com.dingtalk.open</groupId >
66 <artifactId >app-stream-network</artifactId >
7- <version >1.3.6 </version >
7+ <version >1.3.7 </version >
88 <relativePath >../pom.xml</relativePath >
99 </parent >
1010
Original file line number Diff line number Diff line change 55 <parent >
66 <artifactId >open-app-stream-client</artifactId >
77 <groupId >com.dingtalk.open</groupId >
8- <version >1.3.6 </version >
8+ <version >1.3.7 </version >
99 <relativePath >../pom.xml</relativePath >
1010 </parent >
1111 <packaging >pom</packaging >
Original file line number Diff line number Diff line change 66 <parent >
77 <groupId >com.dingtalk.open</groupId >
88 <artifactId >open-app-stream-client</artifactId >
9- <version >1.3.6 </version >
9+ <version >1.3.7 </version >
1010 </parent >
1111
1212 <artifactId >app-stream-protocol</artifactId >
Original file line number Diff line number Diff line change 44 <parent >
55 <groupId >com.dingtalk.open</groupId >
66 <artifactId >open-app-stream-client</artifactId >
7- <version >1.3.6 </version >
7+ <version >1.3.7 </version >
88 <relativePath >../pom.xml</relativePath >
99 </parent >
1010
1111 <artifactId >dingtalk-stream</artifactId >
1212 <packaging >jar</packaging >
13- <version >1.3.6 </version >
13+ <version >1.3.7 </version >
1414 <name >app-stream-client</name >
1515
1616 <dependencies >
You can’t perform that action at this time.
0 commit comments