SPR-17492: FastByteArrayOutputStream.read byte-to-int conversion
This commit is contained in:
committed by
Juergen Hoeller
parent
88cb126511
commit
12f168290d
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.springframework.util;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
@@ -137,6 +138,15 @@ public class FastByteArrayOutputStreamTests {
|
||||
assertEquals(inputStream.read(), this.helloBytes[3]);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getInputStreamReadBytePromotion() throws Exception {
|
||||
byte[] bytes = new byte[] { -1 };
|
||||
this.os.write(bytes);
|
||||
InputStream inputStream = this.os.getInputStream();
|
||||
ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
|
||||
assertEquals(bais.read(), inputStream.read());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getInputStreamReadAll() throws Exception {
|
||||
this.os.write(this.helloBytes);
|
||||
|
||||
Reference in New Issue
Block a user