| 118 |
byte[] bytes = new byte[BLOCK_SIZE]; |
byte[] bytes = new byte[BLOCK_SIZE]; |
| 119 |
try { |
try { |
| 120 |
int length = reader.read(bytes); |
int length = reader.read(bytes); |
| 121 |
String str = new String(bytes, 0, length, |
if (length != -1) { |
| 122 |
bufferedResponseStream.getEncoding()); |
String str = new String(bytes, 0, length, |
| 123 |
int beginBodyIndex = str.indexOf("<body"); |
bufferedResponseStream.getEncoding()); |
| 124 |
if (beginBodyIndex >= 0) { |
int beginBodyIndex = str.indexOf("<body"); |
| 125 |
str = str.substring(beginBodyIndex).replaceFirst( |
if (beginBodyIndex >= 0) { |
| 126 |
"<body[^>]*>", ""); |
str = str.substring(beginBodyIndex).replaceFirst( |
| 127 |
int endBodyIndex = str.indexOf("</body"); |
"<body[^>]*>", ""); |
| 128 |
if (endBodyIndex >= 0) { |
int endBodyIndex = str.indexOf("</body"); |
| 129 |
writer.write(str.substring(0, endBodyIndex)); |
if (endBodyIndex >= 0) { |
| 130 |
|
writer.write(str.substring(0, endBodyIndex)); |
| 131 |
|
} else { |
| 132 |
|
length = reader.read(bytes); |
| 133 |
|
while (length != -1) { |
| 134 |
|
str = new String(bytes, 0, length, |
| 135 |
|
bufferedResponseStream.getEncoding()); |
| 136 |
|
endBodyIndex = str.indexOf("</body"); |
| 137 |
|
if (endBodyIndex >= 0) { |
| 138 |
|
writer |
| 139 |
|
.write(str.substring(0, |
| 140 |
|
endBodyIndex)); |
| 141 |
|
break; |
| 142 |
|
} else { |
| 143 |
|
if (length != 0) { |
| 144 |
|
writer.write(str); |
| 145 |
|
} |
| 146 |
|
length = reader.read(bytes); |
| 147 |
|
} |
| 148 |
|
} |
| 149 |
|
} |
| 150 |
} else { |
} else { |
| 151 |
|
if (length != -1) { |
| 152 |
|
writer.write(str); |
| 153 |
|
} |
| 154 |
length = reader.read(bytes); |
length = reader.read(bytes); |
| 155 |
while (length != -1) { |
while (length != -1) { |
| 156 |
str = new String(bytes, 0, length, |
str = new String(bytes, 0, length, |
| 157 |
bufferedResponseStream.getEncoding()); |
bufferedResponseStream.getEncoding()); |
| 158 |
endBodyIndex = str.indexOf("</body"); |
if (length != 0) { |
| 159 |
if (endBodyIndex >= 0) { |
writer.write(str); |
|
writer.write(str.substring(0, endBodyIndex)); |
|
|
break; |
|
|
} else { |
|
|
if (length != 0) { |
|
|
writer.write(str); |
|
|
} |
|
|
length = reader.read(bytes); |
|
| 160 |
} |
} |
| 161 |
|
length = reader.read(bytes); |
| 162 |
} |
} |
| 163 |
} |
} |
|
} else { |
|
|
if (length != -1) { |
|
|
writer.write(str); |
|
|
} |
|
|
length = reader.read(bytes); |
|
|
while (length != -1) { |
|
|
str = new String(bytes, 0, length, |
|
|
bufferedResponseStream.getEncoding()); |
|
|
if (length != 0) { |
|
|
writer.write(str); |
|
|
} |
|
|
length = reader.read(bytes); |
|
|
} |
|
| 164 |
} |
} |
| 165 |
writer.flush(); |
writer.flush(); |
| 166 |
} finally { |
} finally { |