79271609

Date: 2024-12-11 11:59:36
Score: 1
Natty:
Report link

You can simply use a for loop (it is still duplicating some code though):

OutputStream os = ...;
InputStream is = ...;
byte[] buffer = new byte[1024];
for (int bufferLength = is.read(buffer); bufferLength != -1; bufferLength = is.read(buffer)) {
   os.write(buffer, 0, bufferLength);
}
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: IceWil