/** * This is used to write plain text to the output stream without any translation. This is used * when writing the start tags and end tags, this is also used to write attribute names. * * @param plain this is the text to be written to the output * @param prefix this is the namespace prefix to be written */ private void write(String plain, String prefix) throws Exception { buffer.write(result); buffer.clear(); if (!isEmpty(prefix)) { result.write(prefix); result.write(':'); } result.write(plain); }
public void serialize(OutputBuffer buf) throws IOException { from.serialize(buf); buf.writeFloat(x); buf.writeFloat(y); buf.writeFloat(z); buf.writeFloat(rw); buf.writeFloat(rx); buf.writeFloat(ry); buf.writeFloat(rz); buf.writeUTF(name); }
void _test(BSONObject o, int size, String hash) throws IOException { BSONEncoder e = new BSONEncoder(); OutputBuffer buf = new BasicOutputBuffer(); e.set(buf); e.putObject(o); assertEquals(size, buf.size()); assertEquals(hash, buf.md5()); e.done(); BSONDecoder d = new BSONDecoder(); BasicBSONCallback cb = new BasicBSONCallback(); int s = d.decode(new ByteArrayInputStream(buf.toByteArray()), cb); assertEquals(size, s); OutputBuffer buf2 = new BasicOutputBuffer(); e.set(buf2); e.putObject((BSONObject) cb.get()); assertEquals(size, buf2.size()); assertEquals(hash, buf2.md5()); }
public void runCompress(int btid) { spec.harness.Context.getOut().println("Loop count = " + LOOP_COUNT); for (int i = 0; i < LOOP_COUNT; i++) { for (int j = 0; j < FILES_NUMBER; j++) { Source source = SOURCES[j]; OutputBuffer comprBuffer, decomprBufer; comprBuffer = CB.performAction( source.getBuffer(), source.getLength(), CB.COMPRESS, COMPRESS_BUFFERS[btid - 1]); decomprBufer = CB.performAction( COMPRESS_BUFFERS[btid - 1], comprBuffer.getLength(), CB.UNCOMPRESS, DECOMPRESS_BUFFERS[btid - 1]); Context.getOut().print(source.getLength() + " " + source.getCRC() + " "); Context.getOut().print(comprBuffer.getLength() + comprBuffer.getCRC() + " "); Context.getOut().println(decomprBufer.getLength() + " " + decomprBufer.getCRC()); } } }
public void serialize(OutputBuffer buf) throws IOException { boolean hasSource = (source != null); buf.writeBoolean(hasSource); if (hasSource) source.serialize(buf); topic.serialize(buf); }
/** * Bytes written to socket - i.e. after compression, chunking, etc. * * @param flush Should any remaining bytes be flushed before returning the total? If {@code false} * bytes remaining in the buffer will not be included in the returned value * @return The total number of bytes written to the socket for this response */ public long getBytesWritten(boolean flush) { if (flush) { action(ActionCode.CLIENT_FLUSH, this); } return outputBuffer.getBytesWritten(); }
/** * Write a chunk of bytes. * * @param chunk The bytes to write * @throws IOException If an I/O error occurs during the write */ public void doWrite(ByteChunk chunk) throws IOException { outputBuffer.doWrite(chunk); contentWritten += chunk.getLength(); }
/** Write a chunk of bytes. */ public void doWrite(ByteChunk chunk /*byte buffer[], int pos, int count*/) throws IOException { outputBuffer.doWrite(chunk, this); bytesWritten += chunk.getLength(); }
/** * This is used to flush the writer when the XML if it has been buffered. The flush method is used * by the node writer after an end element has been written. Flushing ensures that buffering does * not affect the result of the node writer. */ public void flush() throws Exception { buffer.write(result); buffer.clear(); result.flush(); }
/** * This is used to buffer characters to the output stream without any translation. This is used * when buffering the start tags so that they can be reset without affecting the resulting * document. * * @param plain this is the string that is to be buffered */ private void append(String plain) throws Exception { buffer.append(plain); }
/** * This is used to buffer characters to the output stream without any translation. This is used * when buffering the start tags so that they can be reset without affecting the resulting * document. * * @param plain this is the string that is to be buffered */ private void append(char[] plain) throws Exception { buffer.append(plain); }
/** * This is used to buffer a character to the output stream without any translation. This is used * when buffering the start tags so that they can be reset without affecting the resulting * document. * * @param ch this is the character to be written to the output */ private void append(char ch) throws Exception { buffer.append(ch); }
/** * This is used to write plain text to the output stream without any translation. This is used * when writing the start tags and end tags, this is also used to write attribute names. * * @param plain this is the text to be written to the output */ private void write(String plain) throws Exception { buffer.write(result); buffer.clear(); result.write(plain); }
/** * This is used to write a character to the output stream without any translation. This is used * when writing the start tags and end tags, this is also used to write attribute names. * * @param ch this is the character to be written to the output */ private void write(char ch) throws Exception { buffer.write(result); buffer.clear(); result.write(ch); }