public final void writeToBuffer(T t, byte[] buffer) {
        if (t == null) {
            throw new InvalidArgument("cannot write a null");
        } else if (buffer == null) {
            throw new InvalidArgument("cannot write to a null buffer");
        } else if (buffer.length != recordSize) {
            final String fmt = "invalid buffer (%d bytes, expected %d)";
            final String msg = format(fmt, buffer.length, recordSize);
            throw new InvalidArgument(msg);
        }
        writeTo(t, buffer);
    }
public final void writeToBuffer ( T t , byte [ ] buffer ) { if ( t == null ) { throw new InvalidArgument ( "cannot write a null" ) ; } else if ( buffer == null ) { throw new InvalidArgument ( "cannot write to a null buffer" ) ; } else if ( buffer . length != recordSize ) { final String fmt = "invalid buffer (%d bytes, expected %d)" ; final String msg = format ( fmt , buffer . length , recordSize ) ; throw new InvalidArgument ( msg ) ; } writeTo ( t , buffer ) ; }
Writes {@code <T>} to the provided {@code buffer}.

@param t {@code <T>}
@param buffer {@code byte[]}; of size {@link #getRecordSize()}
@throws InvalidArgument Thrown if either argument is null or if