001// Licensed under the MIT license. See LICENSE file in the project root for full license information.
002
003package de.bytefish.pgbulkinsert.pgsql.handlers;
004
005import de.bytefish.pgbulkinsert.pgsql.handlers.utils.GeometricUtils;
006import de.bytefish.pgbulkinsert.pgsql.model.geometric.Box;
007
008import java.io.DataOutputStream;
009
010public class BoxValueHandler extends BaseValueHandler<Box> {
011
012    @Override
013    protected void internalHandle(DataOutputStream buffer, final Box value) throws Exception {
014        buffer.writeInt(32);
015
016        GeometricUtils.writePoint(buffer, value.getHigh());
017        GeometricUtils.writePoint(buffer, value.getLow());
018    }
019
020    @Override
021    public int getLength(Box value) {
022        return 32;
023    }
024}