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 java.io.DataOutputStream;
006
007public class BooleanValueHandler extends BaseValueHandler<Boolean> {
008
009    @Override
010    protected void internalHandle(DataOutputStream buffer, final Boolean value) throws Exception {
011        buffer.writeInt(1);
012        if (value) {
013            buffer.writeByte(1);
014        } else {
015            buffer.writeByte(0);
016        }
017    }
018
019
020    @Override
021    public int getLength(Boolean value) {
022        return 1;
023    }
024}