Movatterモバイル変換


[0]ホーム

URL:


CN109413450A - A kind of integrity checking method, device, terminal and the storage medium of barrage data - Google Patents

A kind of integrity checking method, device, terminal and the storage medium of barrage data
Download PDF

Info

Publication number
CN109413450A
CN109413450ACN201811158727.7ACN201811158727ACN109413450ACN 109413450 ACN109413450 ACN 109413450ACN 201811158727 ACN201811158727 ACN 201811158727ACN 109413450 ACN109413450 ACN 109413450A
Authority
CN
China
Prior art keywords
character
current
barrage data
target
default
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201811158727.7A
Other languages
Chinese (zh)
Other versions
CN109413450B (en
Inventor
张磊
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Wuhan Douyu Network Technology Co Ltd
Original Assignee
Wuhan Douyu Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Wuhan Douyu Network Technology Co LtdfiledCriticalWuhan Douyu Network Technology Co Ltd
Priority to CN201811158727.7ApriorityCriticalpatent/CN109413450B/en
Publication of CN109413450ApublicationCriticalpatent/CN109413450A/en
Application grantedgrantedCritical
Publication of CN109413450BpublicationCriticalpatent/CN109413450B/en
Activelegal-statusCriticalCurrent
Anticipated expirationlegal-statusCritical

Links

Classifications

Landscapes

Abstract

The embodiment of the invention discloses integrity checking method, device, terminal and the storage mediums of a kind of barrage data, this method comprises: the target barrage data of preset characters string structure are converted to target character array, and using the first character element in target character array as current character element;Whether detection current character element is default separator, if, then the first character string between current start position and current end position is verified using the position of current character element as current end position using current end position as current start position;If it is not, the first character string verify successfully, then when current character element is not last character element in target character array, update current character element, and return execute detection current character element whether be default separator operation;When current character element is last character element, the success of target barrage data check is determined, to carry out completeness check to barrage data.

Description

A kind of integrity checking method, device, terminal and the storage medium of barrage data
Technical field
The present embodiments relate to barrage technical field more particularly to a kind of integrity checking methods of barrage data, dressIt sets, terminal and storage medium.
Background technique
With the fast development of intelligent terminal, various application software are by development and application in intelligent terminal.Some applications are softPart be such as broadcast live software, often have the function of in video jukebox software barrage receive, the barrages such as parsing and push.Developing theseDuring application software, just whether the barrage data for needing to issue server carry out dependence test, to determine barrage functionOften operation.
Currently, server is according to default barrage protocol construction in the applied software development based on Android operation systemAfter completing barrage data, often directly by the barrage data distributing of building to client, and client is receiving barrageWhen data, and parsing and distribution processor directly are carried out to barrage data.
As it can be seen that server and client side is not to barrage in existing barrage data distributing process and receive processData carry out any verification, to barrage testing process will be caused mistake occur, very when barrage data are there are when abnormal conditionsTo leading to problems such as client system crash occur, barrage testing efficiency has been seriously affected.
Summary of the invention
The embodiment of the invention provides integrity checking method, device, terminal and the storage medium of a kind of barrage data, withCompleteness check is carried out to barrage data, to guarantee that barrage data can be normally resolved, avoiding result in client isThe problems such as system collapse.
In a first aspect, the embodiment of the invention provides a kind of integrity checking methods of barrage data, comprising:
Obtain the target barrage data of preset characters string structure, wherein the target barrage data include default separator andDefault connector;
The character string transfer function in the barrage data object for storing the target barrage data is called, by the target bulletCurtain data are converted to target character array, and the first character element in the target character array is determined as current characterElement, and the corresponding element position of the first character element is determined as current end position;
Detect whether current character element is the default separator;
If so, current end position is determined as current start position, and by the corresponding element of current character elementPosition is determined as current end position, and in the target barrage data between current start position and current end positionFirst character string carries out the verification of default connector quantity;
If it is not, first character string verify successfully, then be not the target character array in current character elementIn last character element when, update current character element be current character element next character element, and return holdRow it is described detection current character element whether be the default separator operation;
If it is not, first character string verify successfully, then be in the target character array in current character elementLast character element when, determine target barrage data check success.
Second aspect, the embodiment of the invention also provides a kind of completeness check devices of barrage data, comprising:
Target barrage data acquisition module, for obtaining the target barrage data of preset characters string structure, wherein the meshMarking barrage data includes default separator and default connector;
Target barrage data conversion module, for calling the word in the barrage data object for storing the target barrage dataThe target barrage data are converted to target character array by symbol string transfer function, and by the in the target character arrayOne character element is determined as current character element, and the corresponding element position of the first character element is determined as working asPreceding end position;
Current character Element detection module, for detecting whether current character element is the default separator;
First character string correction verification module, for if so, current end position is determined as current start position, and generalThe corresponding element position of current character element is determined as current end position, and to current start bit in the target barrage dataSet the verification that the first character string between current end position carries out default connector quantity;
Current character element update module, be used for if it is not, first character string verify successfully, then in current characterWhen element is not the last character element in the target character array, update current character element is current character elementNext character element, and return execute it is described detection current character element whether be the default separator operation;
Target barrage data check success module, be used for if it is not, first character string verify successfully, then currentWhen character element is the last character element in the target character array, determine the target barrage data check atFunction.
The third aspect, the embodiment of the invention also provides a kind of terminal, the terminal includes:
One or more processors;
Memory, for storing one or more programs;
When one or more of programs are executed by one or more of processors, so that one or more of processingDevice realizes the integrity checking method such as barrage data provided by any embodiment of the invention.
Fourth aspect, the embodiment of the invention also provides a kind of computer readable storage mediums, are stored thereon with computerProgram realizes the completeness check side such as barrage data provided by any embodiment of the invention when the program is executed by processorMethod.
The embodiment of the present invention is by way of cyclic check, before first default separator in target barrage dataThe first character string between first character string and two default separators of arbitrary neighborhood carries out default connector quantity one by oneVerification determine the success of target barrage data check and when each first character string verifies successfully, to realize to defaultThe completeness check of the target barrage data of character string structure, and then after the success of target barrage data check, it can be to targetBarrage data are normally parsed, and avoid leads to problems such as client system crash occur because of barrage data exception, are improvedBarrage testing efficiency.
Detailed description of the invention
Fig. 1 is a kind of flow chart of the integrity checking method for barrage data that the embodiment of the present invention one provides;
Fig. 2 is a kind of flow chart of the integrity checking method of barrage data provided by Embodiment 2 of the present invention;
Fig. 3 is a kind of flow chart of the integrity checking method for barrage data that the embodiment of the present invention three provides;
Fig. 4 is a kind of structural schematic diagram of the completeness check device for barrage data that the embodiment of the present invention four provides;
Fig. 5 is a kind of structural schematic diagram for terminal that the embodiment of the present invention five provides.
Specific embodiment
The present invention is described in further detail with reference to the accompanying drawings and examples.It is understood that this place is retouchedThe specific embodiment stated is used only for explaining the present invention rather than limiting the invention.It also should be noted that in order to justOnly the parts related to the present invention are shown in description, attached drawing rather than entire infrastructure.
Embodiment one
Fig. 1 is a kind of flow chart of the integrity checking method for barrage data that the embodiment of the present invention one provides, this implementationExample is applicable to carry out integrality school to the barrage data of the preset characters string structure comprising presetting separator and default connectorThe case where testing, it is particularly possible to after in barrage server according to barrage agreement generation barrage data are preset, to the barrage of generationIn the application scenarios that data are verified, while it can be used for the barrage issued in Android client to barrage serverIn the application scenarios that data are verified.This method can be executed by the completeness check device of barrage data, which canRealized in a manner of by software and/or hardware, can be integrated in barrage server or be equipped with android system have bulletIn the terminal of curtain function, such as the intelligent terminals such as smart phone, tablet computer, smart television or laptop.Such as Fig. 1 instituteShow, this method specifically includes the following steps:
S110, the target barrage data for obtaining preset characters string structure, wherein target barrage data include default separatorWith default connector.
Wherein, barrage data can refer to barrage parameter information is packaged according to default barrage agreement after the word that obtainsThe data of symbol string String type.Default barrage agreement can be preset with user demand according to the actual situation, be used forThe transmission data structure for providing barrage data, so as to can carry out data transmission between barrage server and client.Default bulletCurtain agreement can specify that one or more data structures.Preset characters string structure can be one kind specified in default barrage agreementData structure.Preset characters string structure is corresponding with default barrage agreement.Target barrage data can refer to be verified presetThe barrage data of character string structure.Default separator and default connector are all based on preset characters as defined in default barrage agreementWith the character or character string of specific meanings in string structure.Default separator can be used for dividing barrage parameter information, the company of presettingConnecing symbol can be used for connecting barrage parameter information.Default separator and default connector may each comprise a preset characters,It may include multiple preset characters, wherein preset characters can be a kind of number, letter or additional character predetermined etc..Illustratively, default separator can be used for dividing each key-value pair information in preset characters string structure, such as monocline thick stick " ","/", double slashes " " and " // " etc..Default connector can be used for connecting key information and value information in key-value pair information, thanSuch as "-", "@", ", " "==" and "@=" etc..
Optionally, S110 includes: to obtain barrage data to be verified and the corresponding data to be verified of barrage data to be verifiedMark;Data Identification in Data Identification to be verified logo collection corresponding with preset characters string structure is matched;IfWith success, then barrage data to be verified are determined as target barrage data.
Wherein, barrage data to be verified can be barrage parameter information is packaged according to default barrage agreement after obtainAny data structure barrage data.Each barrage data to be verified correspond to a Data Identification to be verified.Number to be verifiedAccording to mark for carrying out unique identification to barrage data to be verified, can determine barrage to be verified by Data Identification to be verifiedThe data structure of data.The corresponding logo collection of preset characters string structure may include: that data structure is preset characters string structureThe corresponding Data Identification of all barrage data.
It specifically,, can be pre- when generating some barrage data if default barrage agreement defines plurality of data structuresWhether the data structure for first detecting the barrage data of generation is preset characters string structure, if so, the barrage data are correspondingData Identification is added in the corresponding logo collection of preset characters string structure, to be preset characters string by the data structure of generationThe corresponding Data Identification of barrage data of structure is added in the logo collection, to carry out subsequent verification operation.It is obtainingIt, can be by Data Identification to be verified and preset characters string structure pair after taking the corresponding Data Identification to be verified of barrage data to be verifiedThe Data Identification in logo collection answered is matched one by one, if any data mark in Data Identification to be verified and logo collectionKnow successful match, then shows that the data structure of the barrage data to be verified is preset characters string structure, this can be waited for into school at this timeIt tests barrage data and is determined as target barrage data, to carry out completeness check to target barrage data.If data mark to be verifiedIt fails to match with each Data Identification in logo collection for knowledge, then shows that the data structure of the barrage data to be verified is not pre-If character string structure, matching can be identified to next barrage data to be verified at this time, until obtaining preset characters string structureTarget barrage data.
S120, calling store the character string transfer function in the barrage data object of target barrage data, by target barrageData are converted to target character array, and the first character element in target character array is determined as current character element,And the corresponding element position of first character element is determined as current end position.
Wherein, barrage data object is one for storing the object of target barrage data.Target bullet in the present embodimentCurtain data are the data of a String type, so that barrage data object is a String object.Character string transfer functionBe it is predetermined, for target barrage data to be converted to the function of a character array.Character in target character arrayOrder of elements is consistent with the character sequence in target barrage data.Illustratively, if barrage data object is labeled asDanmuStr, then the character string transfer function in danmuStr can be with are as follows: danmuStr.toCharArray (), so as toThe target barrage data stored in danmuStr are converted into target character array.Current character element refers to current targetA character element in character array.Current end position refers to current time corresponding end position.
Specifically, it is assumed that the target barrage data stored in barrage data object danmuStr are as follows: abcd passes through callingThe object of each lower mark of danmuStr is then stored in by danmuStrChar=danmuStr.toCharArray ()In target character array danmuStrChar, i.e. danmuStrChar are as follows: { ' a ', ' b ', ' c ', ' d ' }.The present embodiment can be rightCharacter element in first character array is looped through, to promote calculating speed.In first time cycle period, by targetFirst character element in character array is corresponding by first character element in target character array as current character elementElement position as current end position, current end position at this time is danmuStrChar [0] corresponding position.
Whether S130, detection current character element are default separator, if so, S140 is entered step, if it is not, then enteringStep S150.
It specifically, whether is default separator by detection current character element, it is each in target barrage data to determineThe position of default separator, to obtain the barrage data and every two in target barrage data before first default separatorBarrage data between a adjacent default separator.
S140, current end position is determined as to current start position, and by the corresponding element position of current character elementIt sets and is determined as current end position, and to the first word in target barrage data between current start position and current end positionThe verification that symbol string carries out default connector quantity enters step S150 when the first character string verifies successfully.
Wherein, current start position and current end position refer to two extraction points in current target barrage dataPosition, to extract barrage data (i.e. the first character string) in target barrage data before first default separator or adjacentTwo default separators between barrage data (i.e. the first character string).
Specifically, when current character element is default separator, using current end position as current start position, withCurrent start position is updated, it is current to update then using the corresponding element position of current character element as current end positionEnd position.According to updated current start position and current end position, current start bit in target barrage data is extractedSet the first character string between current end position.Illustratively, in first cycle period, updated current beginningPosition is first character element in target character array, and updated current end position is first in target character arrayThe default corresponding element position of separator, so that the first character string extracted is first default separator in target barrage dataBarrage data before.In second cycle period, updated current start position is first in target character arrayThe corresponding element position of a default separator, updated current end position be in target character array second default separateCorresponding element position is accorded with, so that the first character string extracted is first default separator in target barrage data and secondBarrage data between default separator;Similarly, in subsequent cycle period, the first character string of extraction is target barrageBarrage data in data between two neighboring default separator.
The present embodiment needs to carry out school to the default connector quantity in the first character string after obtaining the first character stringIt tests, to detect the regulation whether the first character string meets default barrage agreement.If the first character string verifies successfully, show targetThe first character string in barrage data is the data of a complete and accurate, can carry out subsequently verification operation at this time.If firstCharacter string verification failure, then show that first character string is a deficiency of data, that is to say, that target barrage data are oneInvalid data can directly determine the failure of target barrage data check at this time, so as to quickly determine out default connectorDiscrepancy of quantity closes defined target barrage data, improves barrage and verifies efficiency.
Whether S150, detection current character element are last character element in target character array, if it is not, then intoEnter step S160, if so, entering step S170.
Specifically, whether it is last character element in target character array by detection current character element, comesWhether determine to loop through terminates.Illustratively, array index number in current character element danmuStrChar [index]The value range of index are as follows: 0≤index≤danmuStrChar.length-1, wherein danmuStrChar.length is indicatedThe length of target character array.
S160, current character element is updated for next character element of current character element, and enter step S130.
Specifically, when current character element is not the last character element in target character array, show to recycleTraversal is also not finished, at this time based on the order of elements in target character array, by the character late element of current character elementIt is updated to current character element, by return step S130, to detect whether character late element is default separator.
S170, the success of target barrage data check is determined.
Specifically, when current character element is the last character element in target character array, show circulation timeEnd is gone through, and the first character string of each of target barrage data verifies success, that is to say, that target barrage data are oneThe data of complete and accurate can determine the success of target barrage data check at this time.
It should be noted that function provided by step S120-S170 can be packaged as a bullet by the present embodimentCurtain verification function, thus only need to be using barrage data object as the input object of barrage verification function, by calling barrage verificationThe checking procedure of target barrage data can be realized in function, so that barrage verification is more convenient.Illustratively, barrage verifies letterNumber can be with is defined as: Publis static Boolean checkDanmInfo (String danmuStr).Wherein,CheckDanmInfo is the function name of barrage verification function, and danmuStr is the barrage data pair of character string String typeAs the return value of barrage verification function checkDanmInfo is the object of boolean's Boolean type.If target barrage numberAccording to verifying successfully, then barrage verification function checkDanmInfo can be by calling return true to return to true, if targetThe failure of barrage data check, then barrage verification function checkDanmInfo can call return false to return to false.BulletCurtain verification function checkDanmInfo has public permission modifier public and static types modifier static, in order toDirectly to call checkDanmInfo by class, the convenience of barrage verification function call is improved.
Optionally, before issuing target barrage data to Android client in barrage server, it can use this implementationThe integrity checking method of barrage data provided by example is verified, and after the success of target barrage data check, then is carried outTarget barrage data issue operation, to guarantee that the target barrage data that barrage server issues are accurate complete data.After Android client receives the target barrage data issued, the complete of barrage data provided by the present embodiment can useProperty method of calibration verified again, and after the success of target barrage data check, then target barrage data are carried out at parsingReason improves barrage test effect so as to avoid leading to problems such as client system crash occur because of barrage data exceptionRate.
The embodiment of the present invention is by way of cyclic check, before first default separator in target barrage dataThe first character string between first character string and two default separators of arbitrary neighborhood carries out default connector quantity one by oneVerification determine the success of target barrage data check and when each first character string verifies successfully, to realize to defaultThe completeness check of the target barrage data of character string structure, and then after the success of target barrage data check, it can be to targetBarrage data are normally parsed, and avoid leads to problems such as client system crash occur because of barrage data exception, are improvedBarrage testing efficiency.
Embodiment two
Fig. 2 is a kind of flow chart of the integrity checking method of barrage data provided by Embodiment 2 of the present invention, this implementationExample on the basis of the above embodiments, " in target barrage data between current start position and current end position firstCharacter string carries out the verification of default connector quantity " it is optimized.It is wherein same as the previously described embodiments or corresponding termExplain that details are not described herein.
Referring to fig. 2, barrage data provided in this embodiment integrity checking method the following steps are included:
S210, the target barrage data for obtaining preset characters string structure.
Wherein, preset characters string structure are as follows: using default first symbol as the first character, each key assignments is divided with default separatorTo information, to preset key information and value information in connector connection key-value pair information, using default end mark as ultimate character,Wherein, value information does not include separating character string identical with default separator;When value information includes at least one and default connectionWhen according with identical connection string, the previous character of connection string is default identifier.
In the present embodiment, the first character in accurate complete target barrage data is default first symbol, ultimate characterTo preset end mark, and barrage parameter information exists in the form of key-value pair, i.e., includes between the first character and ultimate characterMultiple key-value pair informations.Illustratively, default first symbol can be but be not limited to left brace " ", left round parentheses " (" or it is leftBracket " [".In order to increase the discrimination between character string body contents, preferably left brace " ".Default end mark canBe but not limited to right brace " ", right round parentheses ") " or right bracket "] ", preferably right brace " ".Preset characters stringDefault separator in structure is used to divide each key-value pair information in barrage data, and default connector is for connecting key-value pairKey information and value information in information.Value information and default end mark in target barrage data in the last one key-value pair informationAlso it can use default separator to be divided, the content for being included so as to distinguishing value.Preset characters string knot in the present embodimentThe prescribed manner of structure can easily facilitate data transmission.
It should be noted that key-value pair information may include English character, Chinese character and/or certain spcial characters.RootAccording to the regulation of default barrage agreement, value information and key information in each key-value pair information will not include and default separator phaseSame separating character string, and the value information in each key-value pair information can not include concatenation character identical with default connectorString also may include connection string identical with default connector, and include at least one and default connection in value informationWhen according with identical connection string, the previous character of each connection string is default identifier.It is default in the present embodimentIdentifier is used to identify a spcial character of connection string in value information, and default identifier is located at connection stringPrior location.Illustratively, default identifier can be but not limited to dollar mark () " " or RMB symbol " ".Each valueConnection string quantity in information is equal with default identifier quantity.
It illustratively, is default separator with "/", with "@if being default end mark with " { " be default first symbol, with " } "=" it is default connector, it is default identifier with " ", then the target barrage data of preset characters string structure can be with are as follows: { type@=0/=uenter/rid@=104838/uid@=20080138/wgei }, including four key-value pair informations, the first keyValue is " type " to the key information in information, and corresponding value information is " uenter ";Key information in second key-value pair information is" rid ", corresponding value information are " 104838 ";Key information in third key-value pair information is " uid ", and corresponding value information is"20080138";Key information in 4th key-value pair information is " wgei ", and corresponding value information is " 0 ", it is seen then that each key-value pairConnection string identical with default connector is not included in information.The target barrage data of preset characters string structure can also be withAre as follows: { type@=uenter/rid@=104838/uid@=20088/avater@=www@douyu $@=tv@com/ },In key information in the 4th key-value pair information be " avater ", corresponding value information is " www@douyu $@=tv@com ", shouldValue information includes a connection string "@=" identical with default connector and a default identifier " $ ".
S220, calling store the character string transfer function in the barrage data object of target barrage data, by target barrageData are converted to target character array, and the first character element in target character array is determined as current character element,And the corresponding element position of first character element is determined as current end position.
Whether S230, detection current character element are default separator, if so, S240 is entered step, if it is not, then enteringStep S270.
S240, current end position is determined as to current start position, and by the corresponding element position of current character elementIt sets and is determined as current end position, and call the first text string extracting function in barrage data object, extract target barrage numberAccording to the first character string between middle current start position and current end position.
Wherein, the first text string extracting function is predetermined in barrage data object, for extracting target barrage numberAccording to the function of the first character string between middle current start position and current end position.Illustratively, the first text string extractingFunction can be danmuStr.subString (startPos, endPos), indicate the first character in the character string extractedPosition be startPos, the position of last character is endPos-1.
Specifically, what the present embodiment extracted is current start position startPos and current stop bits in target barrage dataSet the first character string between endPos, thus the extraction scope in the first text string extracting function should be (startPos+1,EndPos), so that not including current start position and the corresponding character of current end position in the first character string extracted.
Illustratively, if target barrage data danmuStr are as follows: type@=uenter/rid@=104838/uid@=@=0/ 20080138/wgei }, in first time cycle period, the corresponding call number of updated current start position is 0, whenThe corresponding call number of preceding end position is 13, then by calling danmuStr1=danmu Str.subString (1,13), mentionsThe the first character string danmuStr1 taken is first key-value pair information " type@=uenter " in target barrage data.
It S250, take single character as verification step-length, the adjacent character difference of predetermined number every in the first character string is trueIt is set to the second character string, and determines the default connector quantity in the first character string according to each second character string.
Wherein, predetermined number refers to the character in character quantity adjacent in the first character string, that is, the second character stringQuantity.The sum for the preset characters that predetermined number includes according to default connector and default identifier determines.Illustratively, if in advanceIf presetting connector in character string structure includes X preset characters, presetting identifier includes Y preset characters, then predetermined numberFor X+Y.
Specifically, based on the character sequence in the first character string, it is verification step-length with single character, extracts the first character stringIn adjacent predetermined number character, and the character of extraction is formed into a character string based on the character sequence of the first character string(i.e. the second character string).Similarly, corresponding the second all character string of the first character string can be obtained.Illustratively, if firstCharacter string are as follows: abcd, predetermined number 2, then corresponding three the second character strings of first character string, be respectively as follows: ab, bc andcd.The present embodiment can determine the default company in the first character string according to the default connector quantity in each second character stringConnect symbol quantity.Illustratively, each second character string is matched with default connector and default identifier, if some secondComprising default connector in character string, and it is default identifier before default connector, then shows second character stringIn default connector not instead of real default connector, connection string identical with default connector in value information;If not being default identifier before the default connector in the second character string, show the default connection in second character stringSymbol is really to preset connector for connecting key information and value information, can determine the default company in second character string at this timeConnecing symbol quantity is 1.
If S260, default connector quantity meet default verification condition, it is determined that the first character string verifies successfully, and entersStep S270.
Wherein, it can be obtained: no matter be whether there is in value information by the first string analysis to complete and accurate and default companyThe identical connection string of symbol is connect, the first character string should be there is only one for connecting the default connection of key information and value informationSymbol.That is, default verification condition in the present embodiment can be with are as follows: the default connector quantity in the first character string is 1.
Specifically, if the default connector quantity in the first character string meets default test condition, show the first characterDefault connector in string meets regulation, can determine that the first character string verifies successfully at this time.If default connector quantity is discontentedThe default test condition of foot, then show that the first character string in target barrage data is an invalid data, at this time can directly reallyThe barrage data check that sets the goal failure.
Whether S270, detection current character element are last character element in target character array, if it is not, then intoEnter step S280, if so, entering step S290.
S280, current character element is updated for next character element of current character element, and enter step S230.
S290, the success of target barrage data check is determined.
The technical solution of the present embodiment extracts mesh by calling the first text string extracting function in barrage data objectMark the first character string in barrage data between current start position and current end position;And it is walked with single character for verificationIt is long, the adjacent character of predetermined number every in the first character string is identified as the second character string, according to each second character stringIt determines the default connector quantity in the first character string, and when default connector quantity meets default verification condition, determines theOne character string verifies successfully.The first character string in the present embodiment is regardless of whether include concatenation character identical with default connectorString can use the verification that the method for calibration carries out default connector quantity to the first character string, and then it is suitable to increase verificationWith range, and make barrage verification more convenient, improves verification efficiency.
It based on the above technical solution, include the first preset characters and default connector packet in default identifierWhen including the second preset characters and third preset characters, then S250 may include: to determine the first character in the first character stringFor current character;Based on the character sequence in the first character string, by current character and latter two word adjacent with current characterSymbol is determined as current second character string;If the first character in current second character string is not the first preset characters, and currentSecond character and third character in second character string are the second preset characters and third preset characters respectively, then presetConnector variable is carried out from add operation;Whether detection current character is third last character in the first character string;If so,The default connector quantity variate-value of connector variable being determined as in the first character string;If it is not, then updating current character and beingNext character of current character, and return to execution based on the character sequence in the first character string, by current character and with it is currentLatter two adjacent character of character is determined as the operation of current second character string.
Wherein, when default identifier includes a preset characters, when to preset connector include two preset characters, based on theThree characters of arbitrary neighborhood in the first character string are determined as second character string by the character sequence in one character string, fromAnd available the second all character string.Connector variable is used to store the default connector quantity in the first character string.EvenConnecing symbol variable can be with is defined as: private int Count=0.Wherein, Count is the title of connector variable, and connector becomesAmount Count is the integer variable that an initial value is 0.Connector variable Count has private permission modifier private, withGuarantee only have class belonging to connector variable and its instance object that can just be called.
Specifically, the mode that the present embodiment can use searching loop determines the default connector in each second character stringQuantity, so as to quickly determine the default connector quantity in the first character string.In each cycle period, if currentFirst character in two character strings is not the first preset characters, and second character and third in current second character stringA character is the second preset characters and third preset characters respectively, then shows that current second character string includes one really defaultOtherwise the variate-value of connector variable cumulative 1 can be shown in current second character string and not included real at this time by connectorDefault connector.Then whether detection current character is third last character in the first character string, if so, showing to followRing traversal terminates, at this time connector variable storage be final default connector quantity information, so as to by connectorThe variate-value of variable is determined as the default connector quantity in the first character string;It is also not finished if it is not, then showing to loop through, thenUsing next character of current character as current character, to update current character, to be carried out using updated current characterNext cycle period determines the default connector quantity in next second character string.
Embodiment three
Fig. 3 is a kind of flow chart of the integrity checking method for barrage data that the embodiment of the present invention three provides, this implementationExample optimizes on the basis of the above embodiments: " after default connector quantity meets default verification condition, further includes:Obtain the target link position that connector is preset in the first character string;Call the in the string of the first character string of storageTwo text string extracting functions extract the target value information in the first character string according to target link position;If detecting target value letterBreath is not empty data, it is determined that the first character string verifies successfully.".Wherein identical or corresponding with the various embodiments described above termExplain that details are not described herein.
Referring to Fig. 3, the integrity checking methods of barrage data provided in this embodiment the following steps are included:
S310, the target barrage data for obtaining preset characters string structure.
S320, calling store the character string transfer function in the barrage data object of target barrage data, by target barrageData are converted to target character array, and the first character element in target character array is determined as current character element,And the corresponding element position of first character element is determined as current end position.
Whether S330, detection current character element are default separator, if so, S340 is entered step, if it is not, then enteringStep S390.
S340, current end position is determined as to current start position, and by the corresponding element position of current character elementIt sets and is determined as current end position, and call the first text string extracting function in barrage data object, extract target barrage numberAccording to the first character string between middle current start position and current end position.
It S350, take single character as verification step-length, the adjacent character difference of predetermined number every in the first character string is trueIt is set to the second character string, and determines the default connector quantity in the first character string according to each second character string.
If S360, default connector quantity meet default verification condition, the mesh that connector is preset in the first character string is obtainedMark link position.
Specifically, when default connector quantity meets default verification condition, show in the first character string only comprising oneDefault connector.The present embodiment can be individually determined in the first character string after determining default connector quantity and preset connectorTarget link position, can also be when determining the default connector quantity in the first character string, while determining default connectorTarget link position in the first character string, to improve computational efficiency.
Illustratively, if the first character string danmuStr1 are as follows: avater@=www@douyu $@=tv@com, with "@="It is default identifier with " $ " to preset connector, then will be determined in the first character string danmuStr1 per three adjacent charactersFor second character string, it is seen then that the first character in only one second character string " r@=" is not $, second characterWith third character be respectively@and=, may thereby determine that in the first character string only comprising a default connector, and this is pre-If target link position corresponding call number of the connector in the first character string are as follows: 6 and 7.
S370, calling store the second text string extracting function in the string of the first character string, are connected according to targetPosition is connect, the target value information in the first character string is extracted.
Wherein, string is one for storing the String object of the first character string.Second text string extracting letterNumber be it is predetermined in string, for extracting the function of the target value information in the first character string.Illustratively, wordSymbol string object danmuStr1 in the second text string extracting function can be danmuStr1.subString (startPos,endPos)。
Specifically, the present embodiment can be by calling the length in string danmuStr1 to determine function M=DanmuStr1.length () determines the length M of the first character string of string storage.If default connector only includesOne preset characters, i.e., when target link position Pos1 is only the position of a preset characters, then the second text string extracting functionIn extraction scope should be (Pos1+1, M), so as to extract in the first character string preset connector after character string, andUsing the character string of extraction as target value information.If default connector includes two or more preset characters, basisThe default corresponding target link position of connector determines the corresponding target character position of the last one preset characters in default connectorIt sets, and according to the length of the target character position and the first character string, determines the target value information in the first character string.It is exemplaryGround, if the first character string danmuStr1 are as follows: avater@=www@douyu $@=tv@com is default connector with "@=",Then preset target link position corresponding call number of the connector in the first character string are as follows: 6 and 7 are preset in connectorThe call number of the corresponding target character position of the last one preset characters "=" is 7, the corresponding string length of the first character stringBe 26, at this time can by call string danmuStr1 in danmuStr3=danmuStr1.subString (8,26), the target value information danmuStr3 of extraction are as follows: " www douyu=tv com ".
If S380, target value information are not empty data, it is determined that the first character string verifies successfully, and enters step S390.
Wherein, for the first character string of complete and accurate, the first character string should be a complete key-value pair letterIt ceases, i.e. target value information in the first character string is not centainly sky data.
Specifically, whether detection target value information is sky data, if it is not, then showing that the first character string is a complete keyValue can determine that the first character string verifies successfully, and carry out subsequent verification operation to information at this time;If so, showing firstValue information is lacked in character string, that is to say, that target barrage data are an incomplete data, can directly determine mesh at this timeThe failure of barrage data check is marked, so that the stringency of target barrage data check is improved, so that target barrage data are more completeWhole property, while can also go out lack the barrage data of value information with rapid verification, improve verification efficiency.
Whether S390, detection current character element are last character element in target character array, if it is not, then intoEnter step S391, if so, entering step S392.
S391, current character element is updated for next character element of current character element, and enter step S330.
S391, the success of target barrage data check is determined.
The technical solution of the embodiment of the present invention, the default connector quantity in the first character string meet default verification conditionLater, the second text string extracting function in the string by calling the first character string of storage, according to target connection positionThe target value information extracted in the first character string is set, and guarantees each first by the way that whether detection target value information is sky dataCharacter string includes the value information of a non-empty, and when target value information is empty data, can directly determine target barrageData check failure, so that the stringency of target barrage data check is improved, so that target barrage data have more integrality, andAnd can also go out lack the barrage data of value information with rapid verification, improve verification efficiency.
Based on the above technical solution, before S320, further includes: call the first character in barrage data objectFunction is verified, detects whether the first character in target barrage data is default first symbol;If the first character is default first symbol,The second character in barrage data object is then called to verify function, whether the ultimate character detected in target barrage data is defaultEnd mark;Correspondingly, if it is default end mark that S320, which includes: ultimate character, the barrage number of storage target barrage data is calledAccording to the character string transfer function in object.
Wherein, the first character verifying function is predetermined, for carrying out to the first character in target barrage dataThe function of verification.Second character verifying function be it is predetermined, for carrying out school to the ultimate character in target barrage dataThe function tested.Illustratively, barrage data object is labeled as danmuStr, if default first symbol be " ", default end mark is" ", then call the first character verifying function to can be danmuStr.startWith (" { "), to detect barrage data objectThe first character in target barrage data in danmuStr whether be " ";Second character verifies functionDanmuStr.endWith (" "), to detect the ultimate character in the target barrage data in barrage data object danmuStrWhether be " ".
Specifically, after calling the first character verifying function, if the first character in detection target barrage data is not pre-If first symbol, then show the first character authentication failed, that is, target barrage data are an incomplete data, i.e., it is unqualifiedData can directly determine the failure of target barrage data check at this time.If the first character detected in target barrage data is pre-If first symbol, then show that the first character is proved to be successful, the second character can be called to verify function at this time, detects target barrage dataIn ultimate character whether be that default end mark at this time may be used if it is not, then showing that target barrage data are an incomplete dataTo directly determine the failure of target barrage data check;If so, showing that ultimate character is proved to be successful, i.e., in target barrage dataThe first character and ultimate character be it is legal, can call at this time storage target barrage data barrage data object in wordSymbol string transfer function, to continue to execute subsequent check operation.
The present embodiment, can before the character string transfer function in the barrage data object for calling storage target barrage dataTo verify function and the second character verifying function by the first character in calling barrage data object, respectively to target barrage numberThe first character and ultimate character in carry out character verifying, in the first character authentication failed or ultimate character authentication failedWhen, the failure of target barrage data check can be directly determined;After the first character and ultimate character are proved to be successful, then after carrying outContinuous ground verification operation, so that the stringency of target barrage data check is improved, so that target barrage data have more integrality.
Example IV
Fig. 4 is a kind of structural schematic diagram of the completeness check device for barrage data that the embodiment of the present invention four provides, thisEmbodiment is applicable to carry out the barrage data of the preset characters string structure comprising presetting separator and default connector completeProperty verification the case where, which can specifically include: target barrage data acquisition module 410, target barrage data conversion module420, current character Element detection module 430, the first character string correction verification module 440, current character element update module 450 and meshMark barrage data check success module 460.
Wherein, target barrage data acquisition module 410, for obtaining the target barrage data of preset characters string structure,Middle target barrage data include default separator and default connector;Target barrage data conversion module 420, for calling storageTarget barrage data are converted to target character number by the character string transfer function in the barrage data object of target barrage dataGroup, and the first character element in target character array is determined as current character element, and by first character elementCorresponding element position is determined as current end position;Current character Element detection module 430, for detecting current character elementIt whether is default separator;First character string correction verification module 440, for if so, current end position is determined as currently openingBeginning position, and the corresponding element position of current character element is determined as current end position, and in target barrage dataThe first character string between current start position and current end position carries out the verification of default connector quantity;Current character memberPlain update module 450, be used for if it is not, the first character string verify successfully, then be not target character number in current character elementWhen last character element in group, updates current character element and be next character element of current character element, and returnExecute whether detection current character element is the operation for presetting separator;Target barrage data check success module 460, if forNo or the first character string verifies successfully, then is the last character element in target character array in current character elementWhen, determine the success of target barrage data check.
Optionally, preset characters string structure are as follows: using default first symbol as the first character, each key is divided with default separatorValue is to information, to preset key information and value information in connector connection key-value pair information, using default end mark as last bit wordSymbol, wherein value information does not include separating character string identical with default separator;When value information includes at least one and default companyWhen connecing the identical connection string of symbol, the previous character of connection string is default identifier.
Optionally, the first character string correction verification module 440, comprising:
First text string extracting unit extracts mesh for calling the first text string extracting function in barrage data objectMark the first character string in barrage data between current start position and current end position;
Default connector quantity determination unit will often be preset for being verification step-length with single character in the first character stringThe adjacent character of number is identified as the second character string, and determines presetting in the first character string according to each second character stringConnector quantity, wherein the sum for the preset characters that predetermined number includes according to default connector and default identifier determines;
Default connector quantity verification unit, if meeting default verification condition for default connector quantity, it is determined that theOne character string verifies successfully.
Optionally, presetting identifier includes the first preset characters;Default connector includes that the second preset characters and third are pre-If character;Correspondingly, connector quantity determination unit is preset, is specifically used for: the first character in the first character string is determinedFor current character;Based on the character sequence in the first character string, by current character and latter two word adjacent with current characterSymbol is determined as current second character string;If the first character in current second character string is not the first preset characters, and currentSecond character and third character in second character string are the second preset characters and third preset characters respectively, then presetConnector variable is carried out from add operation;Whether detection current character is third last character in the first character string;If so,The default connector quantity variate-value of connector variable being determined as in the first character string;If it is not, then updating current character and beingNext character of current character, and return to execution based on the character sequence in the first character string, by current character and with it is currentLatter two adjacent character of character is determined as the operation of current second character string.
Optionally, the device further include:
Target link position obtains module, for after default connector quantity meets default verification condition, acquisition theThe target link position of connector is preset in one character string;
Target value information extraction modules, the second character string in string for calling the first character string of storage mentionFunction is taken, according to target link position, extracts the target value information in the first character string;
Target value information detecting module, if not being empty data for target value information, it is determined that the first character string verification atFunction.
Optionally, the device further include:
The first character check module turns for the character string in the barrage data object for calling storage target barrage dataBefore exchange the letters number, calls the first character in barrage data object to verify function, detect the first character in target barrage dataIt whether is default first symbol;
Ultimate character correction verification module calls the in barrage data object if being default first symbol for the first characterTwo characters verify function, detect whether the ultimate character in target barrage data is default end mark;
Correspondingly, target barrage data conversion module 420 is also used to: if ultimate character is default end mark, calling is depositedStore up the character string transfer function in the barrage data object of target barrage data.
Optionally, target barrage data acquisition module 410, is specifically used for: obtaining barrage data to be verified and to be verifiedThe corresponding Data Identification to be verified of barrage data;It will be in Data Identification to be verified logo collection corresponding with preset characters string structureData Identification matched;If successful match, barrage data to be verified are determined as target barrage data.
Any embodiment of that present invention institute can be performed in the completeness check device of barrage data provided by the embodiment of the present inventionThe integrity checking method of the barrage data of offer has the corresponding functional module of integrity checking method for executing barrage dataAnd beneficial effect.
Embodiment five
Fig. 5 is a kind of structural schematic diagram for terminal that the embodiment of the present invention five provides.Referring to Fig. 5, which includes:
One or more processors 510;
Memory 520, for storing one or more programs;
When one or more programs are executed by one or more processors 510, so that one or more processors 510 are realizedSuch as the integrity checking method for the barrage data that any embodiment proposes in above-described embodiment.
In Fig. 5 by taking a processor 510 as an example;Processor 510 and memory 520 in terminal can by bus or itsHe connects mode, in Fig. 5 for being connected by bus.
Memory 520 is used as a kind of computer readable storage medium, can be used for storing software program, journey can be performed in computerSequence and module, such as the corresponding program instruction of the integrity checking method of the barrage data in the embodiment of the present invention/module (exampleSuch as, the target barrage data acquisition module 410 in the completeness check device of barrage data, target barrage data conversion module420, current character Element detection module 430, the first character string correction verification module 440, current character element update module 450 and meshMark barrage data check success module 460).Processor 510 is by running the software program being stored in memory 520, instructionAnd module realizes the integrality of above-mentioned barrage data thereby executing the various function application and data processing of terminalMethod of calibration.
Memory 520 mainly includes storing program area and storage data area, wherein storing program area can store operation systemApplication program needed for system, at least one function;Storage data area, which can be stored, uses created data etc. according to terminal.ThisOutside, memory 520 may include high-speed random access memory, can also include nonvolatile memory, for example, at least oneDisk memory, flush memory device or other non-volatile solid state memory parts.In some instances, memory 520 can be into oneStep includes the memory remotely located relative to processor 510, these remote memories can pass through network connection to terminal.OnThe example for stating network includes but is not limited to internet, intranet, local area network, mobile radio communication and combinations thereof.
The integrity checking method for the barrage data that the terminal that the present embodiment proposes is proposed with above-described embodiment belongs to sameInventive concept, the technical detail of detailed description not can be found in above-described embodiment in the present embodiment, and the present embodiment has and holdsThe identical beneficial effect of integrity checking method of row barrage data.
Embodiment six
The present embodiment provides a kind of computer readable storage mediums, are stored thereon with computer program, and the program is processedThe integrity checking method such as barrage data provided by any embodiment of the invention is realized when device executes.
By the description above with respect to embodiment, it is apparent to those skilled in the art that, the present inventionIt can be realized by software and required common hardware, naturally it is also possible to which by hardware realization, but in many cases, the former is moreGood embodiment.Based on this understanding, technical solution of the present invention substantially in other words contributes to the prior artPart can be embodied in the form of software products, which can store in computer readable storage mediumIn, floppy disk, read-only memory (Read-Only Memory, ROM), random access memory (Random such as computerAccess Memory, RAM), flash memory (FLASH), hard disk or CD etc., including some instructions are with so that a computer is setStandby (can be personal computer, server or the network equipment etc.) executes barrage data described in each embodiment of the present inventionIntegrity checking method.
Note that the above is only a better embodiment of the present invention and the applied technical principle.It will be appreciated by those skilled in the art thatThe invention is not limited to the specific embodiments described herein, be able to carry out for a person skilled in the art it is various it is apparent variation,It readjusts and substitutes without departing from protection scope of the present invention.Therefore, although being carried out by above embodiments to the present inventionIt is described in further detail, but the present invention is not limited to the above embodiments only, without departing from the inventive concept, alsoIt may include more other equivalent embodiments, and the scope of the invention is determined by the scope of the appended claims.

Claims (10)

CN201811158727.7A2018-09-302018-09-30Bullet screen data integrity verification method and device, terminal and storage mediumActiveCN109413450B (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN201811158727.7ACN109413450B (en)2018-09-302018-09-30Bullet screen data integrity verification method and device, terminal and storage medium

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN201811158727.7ACN109413450B (en)2018-09-302018-09-30Bullet screen data integrity verification method and device, terminal and storage medium

Publications (2)

Publication NumberPublication Date
CN109413450Atrue CN109413450A (en)2019-03-01
CN109413450B CN109413450B (en)2021-04-27

Family

ID=65465924

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN201811158727.7AActiveCN109413450B (en)2018-09-302018-09-30Bullet screen data integrity verification method and device, terminal and storage medium

Country Status (1)

CountryLink
CN (1)CN109413450B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN111818331A (en)*2020-08-142020-10-23广州虎牙科技有限公司Method, device, equipment and medium for detecting bullet screen display fluency
CN117109505A (en)*2023-10-242023-11-24中国飞机强度研究所Method for measuring blocking hook posture and determining space deformation data of carrier-based aircraft

Citations (9)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN102158890A (en)*2011-02-162011-08-17中国联合网络通信集团有限公司Methods, equipment and systems for sending and receiving test data
CN104539437A (en)*2014-12-302015-04-22北京奇虎科技有限公司Resource acquisition method and terminal device
CN104967876A (en)*2014-09-302015-10-07腾讯科技(深圳)有限公司Pop-up information processing method and apparatus, and pop-up information display method and apparatus
CN106611134A (en)*2016-06-062017-05-03四川用联信息技术有限公司Cloud data integrity verification method
CN106792208A (en)*2016-11-242017-05-31武汉斗鱼网络科技有限公司Video preference information processing method, apparatus and system
CN106973332A (en)*2017-03-102017-07-21武汉斗鱼网络科技有限公司A kind of barrage message treatment method, analytic method and system
CN107181737A (en)*2017-04-242017-09-19深圳市中远达智能科技有限公司A kind of data processing method, read write line and server
EP3240294A1 (en)*2016-04-182017-11-01Snell Advanced Media LimitedMonitoring audio-visual content with captions
CN108123775A (en)*2016-11-292018-06-05华为技术有限公司The method and apparatus of transmission packet

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN102158890A (en)*2011-02-162011-08-17中国联合网络通信集团有限公司Methods, equipment and systems for sending and receiving test data
CN104967876A (en)*2014-09-302015-10-07腾讯科技(深圳)有限公司Pop-up information processing method and apparatus, and pop-up information display method and apparatus
CN104539437A (en)*2014-12-302015-04-22北京奇虎科技有限公司Resource acquisition method and terminal device
EP3240294A1 (en)*2016-04-182017-11-01Snell Advanced Media LimitedMonitoring audio-visual content with captions
CN106611134A (en)*2016-06-062017-05-03四川用联信息技术有限公司Cloud data integrity verification method
CN106792208A (en)*2016-11-242017-05-31武汉斗鱼网络科技有限公司Video preference information processing method, apparatus and system
CN108123775A (en)*2016-11-292018-06-05华为技术有限公司The method and apparatus of transmission packet
CN106973332A (en)*2017-03-102017-07-21武汉斗鱼网络科技有限公司A kind of barrage message treatment method, analytic method and system
CN107181737A (en)*2017-04-242017-09-19深圳市中远达智能科技有限公司A kind of data processing method, read write line and server

Cited By (3)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN111818331A (en)*2020-08-142020-10-23广州虎牙科技有限公司Method, device, equipment and medium for detecting bullet screen display fluency
CN117109505A (en)*2023-10-242023-11-24中国飞机强度研究所Method for measuring blocking hook posture and determining space deformation data of carrier-based aircraft
CN117109505B (en)*2023-10-242024-01-30中国飞机强度研究所Method for measuring blocking hook posture and determining space deformation data of carrier-based aircraft

Also Published As

Publication numberPublication date
CN109413450B (en)2021-04-27

Similar Documents

PublicationPublication DateTitle
CN109345388B (en)Block chain intelligent contract verification method and device and storage medium
CN110442756A (en)Data verification method, device, computer equipment and storage medium
CN110570196B (en)Transaction data processing method, device, terminal equipment and storage medium
CN110928880B (en)Data processing method, device, terminal and medium based on block chain
CN110930254B (en)Data processing method, device, terminal and medium based on block chain
CN108446221A (en)System detection method, device, computer equipment and storage medium
CN110134795A (en)Generate method, apparatus, computer equipment and the storage medium of validation problem group
US20170019407A1 (en)Method and server for providing image captcha
CN109413016B (en)Rule-based message detection method and device
CN114281888A (en)Block chain consensus method, device, equipment and storage medium
CN111144402A (en) OCR recognition accuracy calculation method, device, device and storage medium
CN113706146B (en)Processing method, device and system for executing batch transactions based on blockchain
CN110569127A (en)Virtual resource transferring, sending and acquiring method and device
CN109413450A (en)A kind of integrity checking method, device, terminal and the storage medium of barrage data
CN115712566A (en)Method, device, equipment and storage medium for checking interface field
CN110909361A (en)Vulnerability detection method and device and computer equipment
CN109299719A (en)Barrage method of calibration, device, terminal and storage medium based on Character segmentation
CN109348304A (en)A kind of method of calibration, device and the terminal of barrage data
CN109348305B (en)Bullet screen data verification method and device, terminal and storage medium
CN109977295A (en)A kind of black and white lists matching process and device
CN109413451A (en)A kind of method of calibration, device and the terminal of barrage data
CN111314151B (en)Node management method, node management device, electronic equipment and computer readable storage medium
CN109325496B (en)Bullet screen checking method and device based on character removal, terminal and storage medium
CN117743457A (en)Block chain data processing method, device and equipment, medium and product
CN109413506A (en)A kind of method of calibration, device, terminal and the storage medium of barrage data

Legal Events

DateCodeTitleDescription
PB01Publication
PB01Publication
SE01Entry into force of request for substantive examination
SE01Entry into force of request for substantive examination
GR01Patent grant
GR01Patent grant

[8]ページ先頭

©2009-2025 Movatter.jp