-
public class ValidationPreferencesThis class allows the client to relax the level of validation when reading a shape file. When instantiated, all validations are turned on by default, so the client can specifically turn off the required ones.
-
-
Field Summary
Fields Modifier and Type Field Description private intexpectedRecordNumberprivate ShapeTypeforceShapeTypeprivate booleanallowBadRecordNumbersprivate booleanallowBadContentLengthprivate booleanallowMultipleShapeTypesprivate booleanallowUnlimitedNumberOfPointsPerShapeprivate intmaxNumberOfPointsPerShapeprivate PartTypeforcePartType
-
Method Summary
Modifier and Type Method Description intgetExpectedRecordNumber()ShapeTypegetForceShapeType()voidsetForceShapeType(ShapeType forceShapeType)Forces the shape type to a specific type, disabling its validation. voidsetAllowBadRecordNumbers(boolean allowBadRecordNumbers)Inhibits the validation of the record numbers; a correct shape file musthave sequential record numbers, starting at 1. voidsetAllowBadContentLength(boolean allowBadContentLength)Inhibits the validation of the content length of each shape. voidsetAllowMultipleShapeTypes(boolean allowMultipleShapeTypes)Allows shapes of multiple types in the file; in a correct shape file allshapes must be of a single type, specified on the header of the file.Defaults to false. voidsetAllowUnlimitedNumberOfPointsPerShape(boolean allowUnlimitedNumberOfPointsPerShape)Allows any (positive) number of points per shape. intgetMaxNumberOfPointsPerShape()voidsetMaxNumberOfPointsPerShape(int maxItems)Specifies the maximum number of points a shape can have. PartTypegetForcePartType()voidsetForcePartType(PartType forcePartType)Forces the part types to a specific type, disabling its validation. booleanisAllowBadRecordNumbers()booleanisAllowMultipleShapeTypes()booleanisAllowBadContentLength()booleanisAllowUnlimitedNumberOfPointsPerShape()-
-
Method Detail
-
getExpectedRecordNumber
int getExpectedRecordNumber()
-
getForceShapeType
ShapeType getForceShapeType()
-
setForceShapeType
void setForceShapeType(ShapeType forceShapeType)
Forces the shape type to a specific type, disabling its validation. Setthis value to null to enable the validation. Defaults to null.
-
setAllowBadRecordNumbers
void setAllowBadRecordNumbers(boolean allowBadRecordNumbers)
Inhibits the validation of the record numbers; a correct shape file musthave sequential record numbers, starting at 1. Defaults to false.
-
setAllowBadContentLength
void setAllowBadContentLength(boolean allowBadContentLength)
Inhibits the validation of the content length of each shape. Defaults tofalse.
-
setAllowMultipleShapeTypes
void setAllowMultipleShapeTypes(boolean allowMultipleShapeTypes)
Allows shapes of multiple types in the file; in a correct shape file allshapes must be of a single type, specified on the header of the file.Defaults to false.
-
setAllowUnlimitedNumberOfPointsPerShape
void setAllowUnlimitedNumberOfPointsPerShape(boolean allowUnlimitedNumberOfPointsPerShape)
Allows any (positive) number of points per shape. It's strongly advised toalways limit the number of points per shape; otherwise, a corrupt file witha gigantic (garbage) number of points may crash the reader with anOutOfMemory error. Defaults to false, with a default limit of 10000.
-
getMaxNumberOfPointsPerShape
int getMaxNumberOfPointsPerShape()
-
setMaxNumberOfPointsPerShape
void setMaxNumberOfPointsPerShape(int maxItems)
Specifies the maximum number of points a shape can have. If a shape isfound with a larger number of points a exception is thrown showing thenumber of points it has. This parameter can be adjusted for differentfiles, or turned off with the methodsetAllowUnlimitedNumberOfPointsPerShape(). Defaults to 10000.
-
getForcePartType
PartType getForcePartType()
-
setForcePartType
void setForcePartType(PartType forcePartType)
Forces the part types to a specific type, disabling its validation. Setthis value to null to enable the validation. Defaults to null.
-
isAllowBadRecordNumbers
boolean isAllowBadRecordNumbers()
-
isAllowMultipleShapeTypes
boolean isAllowMultipleShapeTypes()
-
isAllowBadContentLength
boolean isAllowBadContentLength()
-
isAllowUnlimitedNumberOfPointsPerShape
boolean isAllowUnlimitedNumberOfPointsPerShape()
-
-
-
-