Lines 82-98
Link Here
|
82 |
{ |
82 |
{ |
83 |
// Set the ByteChunk as input to the Intermediate reader |
83 |
// Set the ByteChunk as input to the Intermediate reader |
84 |
iis.setByteChunk( bb ); |
84 |
iis.setByteChunk( bb ); |
85 |
convert(cb, limit); |
|
|
86 |
} |
87 |
|
88 |
private void convert(CharChunk cb, int limit) |
89 |
throws IOException |
90 |
{ |
91 |
try { |
85 |
try { |
92 |
// read from the reader |
86 |
// read from the reader |
93 |
int count = 0; |
87 |
int bbLengthBeforeRead = 0; |
94 |
while( limit > 0 ) { |
88 |
while( limit > 0 ) { |
95 |
int size = limit < BUFFER_SIZE ? limit : BUFFER_SIZE; |
89 |
int size = limit < BUFFER_SIZE ? limit : BUFFER_SIZE; |
|
|
90 |
bbLengthBeforeRead = bb.getLength(); |
96 |
int cnt=conv.read( result, 0, size ); |
91 |
int cnt=conv.read( result, 0, size ); |
97 |
if( cnt <= 0 ) { |
92 |
if( cnt <= 0 ) { |
98 |
// End of stream ! - we may be in a bad state |
93 |
// End of stream ! - we may be in a bad state |
Lines 106-112
Link Here
|
106 |
|
101 |
|
107 |
// XXX go directly |
102 |
// XXX go directly |
108 |
cb.append( result, 0, cnt ); |
103 |
cb.append( result, 0, cnt ); |
109 |
limit -= cnt; |
104 |
limit = limit - (bbLengthBeforeRead - bb.getLength()); |
110 |
} |
105 |
} |
111 |
} catch( IOException ex) { |
106 |
} catch( IOException ex) { |
112 |
if( debug>0) |
107 |
if( debug>0) |
Lines 222-227
Link Here
|
222 |
/** Reset the buffer |
217 |
/** Reset the buffer |
223 |
*/ |
218 |
*/ |
224 |
public final void recycle() { |
219 |
public final void recycle() { |
|
|
220 |
try { |
221 |
// Must clear super's buffer. |
222 |
while (ready()) { |
223 |
// InputStreamReader#skip(long) will allocate buffer to skip. |
224 |
read(); |
225 |
} |
226 |
} catch(IOException ioe){ |
227 |
} |
225 |
} |
228 |
} |
226 |
} |
229 |
} |
227 |
|
230 |
|