FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
codeql/java/ql/src/Performance/InefficientOutputStreamBad.java at main · github/codeql · GitHub
github
codeql
Repository navigation
Code
Issues
1k
(1k)
Pull requests
477
(477)
Discussions
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
codeql
/
java
/
ql
/
src
/
Performance
/
InefficientOutputStreamBad.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
27 lines (23 loc) · 726 Bytes
Breadcrumbs
codeql
/
java
/
ql
/
src
/
Performance
/
InefficientOutputStreamBad.java
Copy path
File metadata and controls
27 lines (23 loc) · 726 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
public
class
DigestCheckingFileOutputStream
extends
OutputStream
{
private
DigestOutputStream
digest
;
private
byte
[]
expectedMD5
;
public
DigestCheckingFileOutputStream
(
File
file
,
byte
[]
expectedMD5
)
throws
IOException
,
NoSuchAlgorithmException
{
this
.
expectedMD5
=
expectedMD5
;
digest
=
new
DigestOutputStream
(
new
FileOutputStream
(
file
),
MessageDigest
.
getInstance
(
"MD5"
));
}
@
Override
public
void
write
(
int
b
)
throws
IOException
{
digest
.
write
(
b
);
}
@
Override
public
void
close
()
throws
IOException
{
super
.
close
();
digest
.
close
();
byte
[]
md5
=
digest
.
getMessageDigest
().
digest
();
if
(
expectedMD5
!=
null
&& !
Arrays
.
equals
(
expectedMD5
,
md5
)) {
throw
new
InternalError
();
}
}
}
Back
|
FazBrowse Home
|
New Git URL