net.sf.marineapi.nmea.sentence
Class SentenceValidator

java.lang.Object
  extended by net.sf.marineapi.nmea.sentence.SentenceValidator

public final class SentenceValidator
extends Object

SentenceValidator for detecting and validation of sentence Strings.

Author:
Kimmo Tuukkanen

Method Summary
static boolean isSentence(String nmea)
           Tells if the specified String matches the NMEA 0183 sentence format.
static boolean isValid(String nmea)
          Tells if the specified String is a valid NMEA 0183 sentence.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

isSentence

public static boolean isSentence(String nmea)

Tells if the specified String matches the NMEA 0183 sentence format.

String is considered as a sentence if it meets the following criteria:

Notice that format matching is not strict; although NMEA 0183 defines a maximum length of 80 chars, the sentence length is not checked. This is due to fact that it seems quite common that devices violate this rule, some perhaps deliberately, some by mistake. Thus, assuming the formatting is otherwise valid, it is not feasible to strictly validate length and discard sentences that just exceed the 80 chars limit.

Parameters:
nmea - String to inspect
Returns:
true if recognized as sentence, otherwise false.

isValid

public static boolean isValid(String nmea)
Tells if the specified String is a valid NMEA 0183 sentence. String is considered as valid sentence if it passes the isSentence(String) test and contains correct checksum. Sentences without checksum are validated only by checking the general sentence characteristics.

Parameters:
nmea - String to validate
Returns:
true if valid, otherwise false.


Copyright (C) 2010-2014 Java Marine API authors. All Rights Reserved.