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.LineSegment;
007
008import java.io.DataOutputStream;
009
010public class LineSegmentValueHandler extends BaseValueHandler<LineSegment> {
011
012    @Override
013    protected void internalHandle(DataOutputStream buffer, final LineSegment value) throws Exception {
014        buffer.writeInt(32);
015
016        GeometricUtils.writePoint(buffer, value.getP1());
017        GeometricUtils.writePoint(buffer, value.getP2());
018    }
019
020    @Override
021    public int getLength(LineSegment value) {
022        return 32;
023    }
024}