return ((WebSocketFrame) obj).binaryData().length();
} else if (obj instanceof FileRegion) {
return ((FileRegion) obj).count();
} else if (obj instanceof ChunkedFile) {
ChunkedFile file = (ChunkedFile) obj;
return file.endOffset() - file.startOffset();
} else {
return -1;
}
}
}