public SpecificFixed(byte[] bytes) { bytes(bytes); }
public SpecificFixed() { setSchema(SpecificData.get().getSchema(getClass())); }
public SpecificFixed(byte[] bytes) { bytes(bytes); }
public SpecificFixed(byte[] bytes) { this(); bytes(bytes); } }
public SpecificFixed(byte[] bytes) { bytes(bytes); }
public SpecificFixed() { bytes(new byte[getClass().getAnnotation(FixedSize.class).value()]); } }
public SpecificFixed() { bytes(new byte[getClass().getAnnotation(FixedSize.class).value()]); } }
public static int getFixedSize(Class<?> clazz) { Type type = getType(clazz); if (type == Type.FIXED) { try { return ((SpecificFixed)clazz.newInstance()).bytes().length; } catch (InstantiationException e) { LOG.warn(e.toString()); return -1; } catch (IllegalAccessException e) { LOG.warn(e.toString()); return -1; } } else { return getFixedSize(type); } }
@Override public ByteBuffer toByteBuffer(SpecificFixed fixed) { if (fixed == null) { return null; } byte[] bytes = fixed.bytes(); if (bytes.length < 1) { return null; } return BytesArraySerializer.get().toByteBuffer(bytes); }