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 ShortValueHandler<T extends Number> extends BaseValueHandler<T> { 008 009 @Override 010 protected void internalHandle(DataOutputStream buffer, final T value) throws Exception { 011 buffer.writeInt(2); 012 buffer.writeShort(value.shortValue()); 013 } 014 015 @Override 016 public int getLength(T value) { 017 return 2; 018 } 019}