Skip to content

Commit

Permalink
ZFrame.toString() now prints binary data as hex-coded string
Browse files Browse the repository at this point in the history
ZFrame.toString() instance method prints binary data as hex-coded string
  • Loading branch information
rjsmith committed Aug 4, 2011
1 parent ced8d27 commit bea3637
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion org/zeromq/ZFrame.hx
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,15 @@ class ZFrame
*/
public function toString():String {
if (!hasData()) return null;
return this.data.toString();
// Dump message as text or binary
var isText = true;
for (i in 0...data.length) {
if (data.get(i) < 32 || data.get(i) > 127) isText = false;
}
if (isText)
return data.toString() ;
else
return strhex();
}

/**
Expand Down

0 comments on commit bea3637

Please sign in to comment.