Skip to content

Commit

Permalink
StandardMultipartFile refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
nuheajiohc committed Jan 11, 2025
1 parent 8c03d55 commit 772a605
Showing 1 changed file with 3 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ public String getContentType() {

@Override
public boolean isEmpty() {
return (this.part.getSize() == 0);
return (getSize() == 0);
}

@Override
Expand All @@ -252,7 +252,7 @@ public long getSize() {

@Override
public byte[] getBytes() throws IOException {
return FileCopyUtils.copyToByteArray(this.part.getInputStream());
return FileCopyUtils.copyToByteArray(getInputStream());
}

@Override
Expand All @@ -270,14 +270,9 @@ public void transferTo(File dest) throws IOException, IllegalStateException {
// At least we offloaded the file from memory storage; it'll get deleted
// from the temp dir eventually in any case. And for our user's purposes,
// we can manually copy it to the requested location as a fallback.
FileCopyUtils.copy(this.part.getInputStream(), Files.newOutputStream(dest.toPath()));
FileCopyUtils.copy(getInputStream(), Files.newOutputStream(dest.toPath()));
}
}

@Override
public void transferTo(Path dest) throws IOException, IllegalStateException {
FileCopyUtils.copy(this.part.getInputStream(), Files.newOutputStream(dest));
}
}

}

0 comments on commit 772a605

Please sign in to comment.