ByteBuf() — netty Function Reference
Architecture documentation for the ByteBuf() function in WebSocketServerBenchmarkPage.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 3d39f380_4505_4a3b_b5b8_9922bb70deaf["ByteBuf()"] 32e8ec6c_128b_be16_7a31_f613c87ec237["WebSocketServerBenchmarkPage"] 3d39f380_4505_4a3b_b5b8_9922bb70deaf -->|defined in| 32e8ec6c_128b_be16_7a31_f613c87ec237 style 3d39f380_4505_4a3b_b5b8_9922bb70deaf fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
example/src/main/java/io/netty/example/http/websocketx/benchmarkserver/WebSocketServerBenchmarkPage.java lines 29–186
public static ByteBuf getContent(String webSocketLocation) {
return Unpooled.copiedBuffer(
"<html><head><title>Web Socket Performance Test</title></head>" + NEWLINE +
"<body>" + NEWLINE +
"<h2>WebSocket Performance Test</h2>" + NEWLINE +
"<label>Connection Status:</label>" + NEWLINE +
"<label id=\"connectionLabel\"></label><br />" + NEWLINE +
"<form onsubmit=\"return false;\">" + NEWLINE +
"Message size:" +
"<input type=\"text\" id=\"messageSize\" value=\"1024\"/><br>" + NEWLINE +
"Number of messages:" +
"<input type=\"text\" id=\"nrMessages\" value=\"100000\"/><br>" + NEWLINE +
"Data Type:" +
"<input type=\"radio\" name=\"type\" id=\"typeText\" value=\"text\" checked>text" +
"<input type=\"radio\" name=\"type\" id=\"typeBinary\" value=\"binary\">binary<br>" + NEWLINE +
"Mode:<br>" + NEWLINE +
"<input type=\"radio\" name=\"mode\" id=\"modeSingle\" value=\"single\" checked>" +
"Wait for response after each messages<br>" + NEWLINE +
"<input type=\"radio\" name=\"mode\" id=\"modeAll\" value=\"all\">" +
"Send all messages and then wait for all responses<br>" + NEWLINE +
"<input type=\"checkbox\" id=\"verifiyResponses\">Verify responded messages<br>" + NEWLINE +
"<input type=\"button\" value=\"Start Benchmark\"" + NEWLINE +
" onclick=\"startBenchmark()\" />" + NEWLINE +
"<h3>Output</h3>" + NEWLINE +
"<textarea id=\"output\" style=\"width:500px;height:300px;\"></textarea>" + NEWLINE +
"<br>" + NEWLINE +
"<input type=\"button\" value=\"Clear\" onclick=\"clearText()\">" + NEWLINE +
"</form>" + NEWLINE +
"<script type=\"text/javascript\">" + NEWLINE +
"var benchRunning = false;" + NEWLINE +
"var messageSize = 0;" + NEWLINE +
"var totalMessages = 0;" + NEWLINE +
"var rcvdMessages = 0;" + NEWLINE +
"var isBinary = true;" + NEWLINE +
"var isSingle = true;" + NEWLINE +
"var verifiyResponses = false;" + NEWLINE +
"var benchData = null;" + NEWLINE +
"var startTime;" + NEWLINE +
"var endTime;" + NEWLINE +
"var socket;" + NEWLINE +
"var output = document.getElementById('output');" + NEWLINE +
"var connectionLabel = document.getElementById('connectionLabel');" + NEWLINE +
"if (!window.WebSocket) {" + NEWLINE +
" window.WebSocket = window.MozWebSocket;" + NEWLINE +
'}' + NEWLINE +
"if (window.WebSocket) {" + NEWLINE +
" socket = new WebSocket(\"" + webSocketLocation + "\");" + NEWLINE +
" socket.binaryType = 'arraybuffer';" + NEWLINE +
" socket.onmessage = function(event) {" + NEWLINE +
" if (verifiyResponses) {" + NEWLINE +
" if (isBinary) {" + NEWLINE +
" if (!(event.data instanceof ArrayBuffer) || " + NEWLINE +
" event.data.byteLength != benchData.byteLength) {" + NEWLINE +
" onInvalidResponse(benchData, event.data);" + NEWLINE +
" return;" + NEWLINE +
" } else {" + NEWLINE +
" var v = new Uint8Array(event.data);" + NEWLINE +
" for (var j = 0; j < benchData.byteLength; j++) {" + NEWLINE +
" if (v[j] != benchData[j]) {" + NEWLINE +
" onInvalidResponse(benchData, event.data);" + NEWLINE +
" return;" + NEWLINE +
" }" + NEWLINE +
" }" + NEWLINE +
" }" + NEWLINE +
" } else {" + NEWLINE +
" if (event.data != benchData) {" + NEWLINE +
" onInvalidResponse(benchData, event.data);" + NEWLINE +
" return;" + NEWLINE +
" }" + NEWLINE +
" }" + NEWLINE +
" }" + NEWLINE +
" rcvdMessages++;" + NEWLINE +
" if (rcvdMessages == totalMessages) {" + NEWLINE +
" onFinished();" + NEWLINE +
" } else if (isSingle) {" + NEWLINE +
" socket.send(benchData);" + NEWLINE +
" }" + NEWLINE +
" };" + NEWLINE +
" socket.onopen = function(event) {" + NEWLINE +
Domain
Subdomains
Source
Frequently Asked Questions
What does ByteBuf() do?
ByteBuf() is a function in the netty codebase, defined in example/src/main/java/io/netty/example/http/websocketx/benchmarkserver/WebSocketServerBenchmarkPage.java.
Where is ByteBuf() defined?
ByteBuf() is defined in example/src/main/java/io/netty/example/http/websocketx/benchmarkserver/WebSocketServerBenchmarkPage.java at line 29.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free