Package org.geotools.data.shapefile.dbf

Examples of org.geotools.data.shapefile.dbf.DbaseFileHeader.addColumn()


        if (!tmp.delete()) {
            throw new IllegalStateException("Unable to clear temp file");
        }
        DbaseFileHeader header = new DbaseFileHeader();
        for (int i = 0; i < types.length; i++) {
            header.addColumn(""+types[i], types[i], sizes[i], decimals[i]);
        }
        header.setNumRecords(values.length);
        FileOutputStream fos = new FileOutputStream(tmp);
        WritableByteChannel channel = fos.getChannel();
        tmp.deleteOnExit();
View Full Code Here


            int fieldLen = FeatureTypes.getFieldLength(type);
            if (fieldLen == FeatureTypes.ANY_LENGTH)
                fieldLen = 255;
            if ((colType == Integer.class) || (colType == Short.class) || (colType == Byte.class)) {
                header.addColumn(colName, 'N', Math.min(fieldLen, 9), 0);
            } else if (colType == Long.class) {
                header.addColumn(colName, 'N', Math.min(fieldLen, 19), 0);
            } else if (colType == BigInteger.class) {
                header.addColumn(colName, 'N', Math.min(fieldLen, 33), 0);
            } else if (Number.class.isAssignableFrom(colType)) {
View Full Code Here

            if (fieldLen == FeatureTypes.ANY_LENGTH)
                fieldLen = 255;
            if ((colType == Integer.class) || (colType == Short.class) || (colType == Byte.class)) {
                header.addColumn(colName, 'N', Math.min(fieldLen, 9), 0);
            } else if (colType == Long.class) {
                header.addColumn(colName, 'N', Math.min(fieldLen, 19), 0);
            } else if (colType == BigInteger.class) {
                header.addColumn(colName, 'N', Math.min(fieldLen, 33), 0);
            } else if (Number.class.isAssignableFrom(colType)) {
                int l = Math.min(fieldLen, 33);
                int d = Math.max(l - 2, 0);
View Full Code Here

            if ((colType == Integer.class) || (colType == Short.class) || (colType == Byte.class)) {
                header.addColumn(colName, 'N', Math.min(fieldLen, 9), 0);
            } else if (colType == Long.class) {
                header.addColumn(colName, 'N', Math.min(fieldLen, 19), 0);
            } else if (colType == BigInteger.class) {
                header.addColumn(colName, 'N', Math.min(fieldLen, 33), 0);
            } else if (Number.class.isAssignableFrom(colType)) {
                int l = Math.min(fieldLen, 33);
                int d = Math.max(l - 2, 0);
                header.addColumn(colName, 'N', l, d);
                // This check has to come before the Date one or it is never reached
View Full Code Here

        Level before = LOGGER.getLevel();
        try {
            LOGGER.setLevel(Level.INFO);

            header.addColumn("emptyString", 'C', 20, 0);
            header.addColumn("emptyInt", 'N', 20, 0);
            header.addColumn("emptyDouble", 'N', 20, 5);
            header.addColumn("emptyFloat", 'F', 20, 5);
            header.addColumn("emptyLogical", 'L', 1, 0);
            header.addColumn("emptyDate", 'D', 20, 0);
View Full Code Here

        Level before = LOGGER.getLevel();
        try {
            LOGGER.setLevel(Level.INFO);

            header.addColumn("emptyString", 'C', 20, 0);
            header.addColumn("emptyInt", 'N', 20, 0);
            header.addColumn("emptyDouble", 'N', 20, 5);
            header.addColumn("emptyFloat", 'F', 20, 5);
            header.addColumn("emptyLogical", 'L', 1, 0);
            header.addColumn("emptyDate", 'D', 20, 0);
            int length = header.getRecordLength();
View Full Code Here

        try {
            LOGGER.setLevel(Level.INFO);

            header.addColumn("emptyString", 'C', 20, 0);
            header.addColumn("emptyInt", 'N', 20, 0);
            header.addColumn("emptyDouble", 'N', 20, 5);
            header.addColumn("emptyFloat", 'F', 20, 5);
            header.addColumn("emptyLogical", 'L', 1, 0);
            header.addColumn("emptyDate", 'D', 20, 0);
            int length = header.getRecordLength();
            header.removeColumn("emptyDate");
View Full Code Here

            LOGGER.setLevel(Level.INFO);

            header.addColumn("emptyString", 'C', 20, 0);
            header.addColumn("emptyInt", 'N', 20, 0);
            header.addColumn("emptyDouble", 'N', 20, 5);
            header.addColumn("emptyFloat", 'F', 20, 5);
            header.addColumn("emptyLogical", 'L', 1, 0);
            header.addColumn("emptyDate", 'D', 20, 0);
            int length = header.getRecordLength();
            header.removeColumn("emptyDate");
            assertTrue(length != header.getRecordLength());
View Full Code Here

            header.addColumn("emptyString", 'C', 20, 0);
            header.addColumn("emptyInt", 'N', 20, 0);
            header.addColumn("emptyDouble", 'N', 20, 5);
            header.addColumn("emptyFloat", 'F', 20, 5);
            header.addColumn("emptyLogical", 'L', 1, 0);
            header.addColumn("emptyDate", 'D', 20, 0);
            int length = header.getRecordLength();
            header.removeColumn("emptyDate");
            assertTrue(length != header.getRecordLength());
            header.addColumn("emptyDate", 'D', 20, 0);
View Full Code Here

            header.addColumn("emptyString", 'C', 20, 0);
            header.addColumn("emptyInt", 'N', 20, 0);
            header.addColumn("emptyDouble", 'N', 20, 5);
            header.addColumn("emptyFloat", 'F', 20, 5);
            header.addColumn("emptyLogical", 'L', 1, 0);
            header.addColumn("emptyDate", 'D', 20, 0);
            int length = header.getRecordLength();
            header.removeColumn("emptyDate");
            assertTrue(length != header.getRecordLength());
            header.addColumn("emptyDate", 'D', 20, 0);
            assertTrue(length == header.getRecordLength());
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.