public static LasPoint1GpsTime newLasPoint( final LasPointCloud pointCloud, final RecordDefinition recordDefinition, final ByteBuffer buffer) { try { return new LasPoint1GpsTime(pointCloud, recordDefinition, buffer); } catch (final IOException e) { throw Exceptions.wrap(e); } }
@Override @SuppressWarnings("unchecked") public <V extends T> V getValue(final byte[] bytes) { try { final ByteArrayInputStream bIn = new ByteArrayInputStream(bytes, 4, bytes.length - 4); final ObjectInputStream in = new ObjectInputStream(bIn); return (V) in.readObject(); } catch (final Exception e) { return (V) Exceptions.throwUncheckedException(e); } }
@Override public byte[] getBytes(final T value) { try { final ByteArrayOutputStream bOut = new ByteArrayOutputStream(); final ObjectOutputStream out = new ObjectOutputStream(bOut); out.writeObject(value); out.close(); final byte[] valueBytes = bOut.toByteArray(); final int size = valueBytes.length; final byte[] sizeBytes = MethodPageValueManager.getValueIntBytes(size); final byte[] bytes = new byte[valueBytes.length + sizeBytes.length]; System.arraycopy(sizeBytes, 0, bytes, 0, sizeBytes.length); System.arraycopy(valueBytes, 0, bytes, sizeBytes.length, valueBytes.length); return bytes; } catch (final Exception e) { return (byte[]) Exceptions.throwUncheckedException(e); } }