コード例 #1
0
 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);
   }
 }
コード例 #2
0
 @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);
   }
 }
コード例 #3
0
  @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);
    }
  }