< prev index next >

src/java.base/share/classes/sun/net/www/http/ChunkedInputStream.java

Print this page

        

*** 76,86 **** /** * The internal buffer array where chunk data is available for the * application to read. */ ! private byte chunkData[] = new byte[4096]; /** * The current position in the buffer. It contains the index * of the next byte to read from <code>chunkData</code> */ --- 76,86 ---- /** * The internal buffer array where chunk data is available for the * application to read. */ ! private byte[] chunkData = new byte[4096]; /** * The current position in the buffer. It contains the index * of the next byte to read from <code>chunkData</code> */
*** 96,106 **** /** * The internal buffer where bytes from the underlying stream can be * read. It may contain bytes representing chunk-size, chunk-data, or * trailer fields. */ ! private byte rawData[] = new byte[32]; /** * The current position in the buffer. It contains the index * of the next byte to read from <code>rawData</code> */ --- 96,106 ---- /** * The internal buffer where bytes from the underlying stream can be * read. It may contain bytes representing chunk-size, chunk-data, or * trailer fields. */ ! private byte[] rawData = new byte[32]; /** * The current position in the buffer. It contains the index * of the next byte to read from <code>rawData</code> */
*** 184,194 **** */ private void ensureRawAvailable(int size) { if (rawCount + size > rawData.length) { int used = rawCount - rawPos; if (used + size > rawData.length) { ! byte tmp[] = new byte[used + size]; if (used > 0) { System.arraycopy(rawData, rawPos, tmp, 0, used); } rawData = tmp; } else { --- 184,194 ---- */ private void ensureRawAvailable(int size) { if (rawCount + size > rawData.length) { int used = rawCount - rawPos; if (used + size > rawData.length) { ! byte[] tmp = new byte[used + size]; if (used > 0) { System.arraycopy(rawData, rawPos, tmp, 0, used); } rawData = tmp; } else {
*** 358,368 **** * Expand or compact chunkData if needed. */ if (chunkData.length < chunkCount + copyLen) { int cnt = chunkCount - chunkPos; if (chunkData.length < cnt + copyLen) { ! byte tmp[] = new byte[cnt + copyLen]; System.arraycopy(chunkData, chunkPos, tmp, 0, cnt); chunkData = tmp; } else { System.arraycopy(chunkData, chunkPos, chunkData, 0, cnt); } --- 358,368 ---- * Expand or compact chunkData if needed. */ if (chunkData.length < chunkCount + copyLen) { int cnt = chunkCount - chunkPos; if (chunkData.length < cnt + copyLen) { ! byte[] tmp = new byte[cnt + copyLen]; System.arraycopy(chunkData, chunkPos, tmp, 0, cnt); chunkData = tmp; } else { System.arraycopy(chunkData, chunkPos, chunkData, 0, cnt); }
*** 665,675 **** * @param len maximum number of bytes to read. * @return the number of bytes read, or <code>-1</code> if the end of * the stream has been reached. * @exception IOException if an I/O error occurs. */ ! public synchronized int read(byte b[], int off, int len) throws IOException { ensureOpen(); if ((off < 0) || (off > b.length) || (len < 0) || ((off + len) > b.length) || ((off + len) < 0)) { --- 665,675 ---- * @param len maximum number of bytes to read. * @return the number of bytes read, or <code>-1</code> if the end of * the stream has been reached. * @exception IOException if an I/O error occurs. */ ! public synchronized int read(byte[] b, int off, int len) throws IOException { ensureOpen(); if ((off < 0) || (off > b.length) || (len < 0) || ((off + len) > b.length) || ((off + len) < 0)) {
< prev index next >