Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
ReyunAdiTool
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
daiwenjie
ReyunAdiTool
Commits
2af06a4e
Commit
2af06a4e
authored
Sep 14, 2021
by
LAPTOP-146U5DF5\28422
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加了读取APK包数据大小的限制,如果超过1G就抛出异常
parent
a226d4c2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
15 deletions
+25
-15
MyLog.java
app/src/main/java/com/fear1ess/reyunaditool/MyLog.java
+1
-1
NetWorkUtils.java
...src/main/java/com/fear1ess/reyunaditool/NetWorkUtils.java
+24
-14
No files found.
app/src/main/java/com/fear1ess/reyunaditool/MyLog.java
View file @
2af06a4e
...
...
@@ -4,7 +4,7 @@ import android.util.Log;
public
class
MyLog
{
private
static
final
String
TAG
=
"MyTest"
;
public
static
boolean
is_Open
=
fals
e
;
public
static
boolean
is_Open
=
tru
e
;
public
static
void
d
(
Object
object
){
if
(
is_Open
){
synchronized
(
object
){
...
...
app/src/main/java/com/fear1ess/reyunaditool/NetWorkUtils.java
View file @
2af06a4e
...
...
@@ -218,33 +218,43 @@ public class NetWorkUtils {
byte
[]
data
=
new
byte
[
8192
];
// ByteArrayOutputStream bo = new ByteArrayOutputStream();
int
len
=
0
;
long
obj
=
1024
*
1024
*
1024L
;
long
sum
=
0
;
while
((
len
=
is
.
read
(
data
))
!=
-
1
){
os
.
write
(
data
,
0
,
len
);
sum
+=
len
;
if
(
sum
>
obj
){
MyLog
.
d
(
"!!!!!!!!!!!!!!!!!!!!!!!!!!!! 读取的数据大于1G 放弃"
);
throw
new
Exception
(
"123123"
);
}
// ++num;
}
MyLog
.
d
(
"!!!!!!!!!!!!!!!!!!!!!!!!!!!! 读取的文件大小:"
+
sum
);
os
.
flush
();
byte
[]
resData
=
null
;
if
(
os
instanceof
ByteArrayOutputStream
)
{
resData
=
((
ByteArrayOutputStream
)
os
).
toByteArray
();
}
String
fileName
=
urlStr
.
split
(
"https://adfly-facebook-1258892624.cos.ap-hongkong.myqcloud.com/apks/"
)[
1
].
split
(
".apk"
)[
0
];
MyLog
.
d
(
"获取的文件名:"
+
fileName
);
String
fileName
=
urlStr
.
split
(
"https://adfly-facebook-1258892624.cos.ap-hongkong.myqcloud.com/apks/"
)[
1
];
MyLog
.
d
(
"获取的文件名1:"
+
fileName
);
fileName
=
fileName
.
substring
(
0
,
fileName
.
length
()-
4
);
MyLog
.
d
(
"获取的文件名2:"
+
fileName
);
res
=
new
Response
(
huc
.
getResponseCode
(),
huc
.
getResponseMessage
(),
resData
,
fileName
);
os
.
close
();
is
.
close
();
huc
.
disconnect
();
}
catch
(
MalformedURLException
e
)
{
e
.
printStackTrace
();
}
catch
(
UnsupportedEncodingException
e
)
{
e
.
printStackTrace
();
}
catch
(
ProtocolException
e
)
{
e
.
printStackTrace
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
catch
(
NoSuchAlgorithmException
e
)
{
e
.
printStackTrace
();
}
catch
(
KeyManagementException
e
)
{
e
.
printStackTrace
();
}
catch
(
Exception
e
)
{
MyLog
.
error
(
e
.
toString
());
}
if
(
os
!=
null
){
try
{
os
.
close
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
MyLog
.
d
(
"发包结束:"
+
urlStr
);
return
res
;
}
...
...
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