MCPcopy Index your code
hub / github.com/apache/tomcat / appendBytes

Method appendBytes

java/org/apache/coyote/ajp/AjpMessage.java:145–171  ·  view source on GitHub ↗

Write a MessageBytes out at the current write position. A null MessageBytes is encoded as a string with length 0. @param mb The data to write

(MessageBytes mb)

Source from the content-addressed store, hash-verified

143 * @param mb The data to write
144 */
145 public void appendBytes(MessageBytes mb) {
146 if (mb == null) {
147 log.error(sm.getString("ajpmessage.null"), new NullPointerException());
148 appendInt(0);
149 appendByte(0);
150 return;
151 }
152 if (mb.getType() != MessageBytes.T_BYTES) {
153 mb.toBytes();
154 ByteChunk bc = mb.getByteChunk();
155 // Need to filter out CTLs excluding TAB. ISO-8859-1 and UTF-8
156 // values will be OK. Strings using other encodings may be
157 // corrupted.
158 byte[] buffer = bc.getBuffer();
159 for (int i = bc.getStart(); i < bc.getEnd(); i++) {
160 // byte values are signed i.e. -128 to 127
161 // The values are used unsigned. 0 to 31 are CTLs so they are
162 // filtered (apart from TAB which is 9). 127 is a control (DEL).
163 // The values 128 to 255 are all OK. Converting those to signed
164 // gives -128 to -1.
165 if ((buffer[i] > -1 && buffer[i] <= 31 && buffer[i] != 9) || buffer[i] == 127) {
166 buffer[i] = ' ';
167 }
168 }
169 }
170 appendByteChunk(mb.getByteChunk());
171 }
172
173
174 /**

Callers 5

appendByteChunkMethod · 0.95
appendStringMethod · 0.80
createBodyMessageMethod · 0.80
prepareResponseMethod · 0.80
writeDataMethod · 0.80

Calls 14

appendIntMethod · 0.95
appendByteMethod · 0.95
getBufferMethod · 0.95
appendByteChunkMethod · 0.95
checkOverflowMethod · 0.95
getByteChunkMethod · 0.80
remainingMethod · 0.80
errorMethod · 0.65
getStringMethod · 0.65
getTypeMethod · 0.65
getMethod · 0.65
toBytesMethod · 0.45

Tested by 2

appendStringMethod · 0.64
createBodyMessageMethod · 0.64