Use Arrays::fill instead of hand-written loop
This commit is contained in:
committed by
Juergen Hoeller
parent
29f382b04e
commit
e94af52510
@@ -49,9 +49,7 @@ public abstract class AbstractXhrTransport implements XhrTransport {
|
||||
|
||||
static {
|
||||
byte[] bytes = new byte[2048];
|
||||
for (int i = 0; i < bytes.length; i++) {
|
||||
bytes[i] = 'h';
|
||||
}
|
||||
Arrays.fill(bytes, (byte) 'h');
|
||||
PRELUDE = new String(bytes, SockJsFrame.CHARSET);
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package org.springframework.web.socket.sockjs.transport.handler;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.http.MediaType;
|
||||
@@ -41,9 +42,7 @@ public class XhrStreamingTransportHandler extends AbstractHttpSendingTransportHa
|
||||
private static final byte[] PRELUDE = new byte[2049];
|
||||
|
||||
static {
|
||||
for (int i = 0; i < 2048; i++) {
|
||||
PRELUDE[i] = 'h';
|
||||
}
|
||||
Arrays.fill(PRELUDE, (byte) 'h');
|
||||
PRELUDE[2048] = '\n';
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user