1 package org.simantics.databoard.serialization.impl;
3 import java.io.DataInput;
4 import java.io.DataOutput;
5 import java.io.IOException;
7 import org.simantics.databoard.binding.LongBinding;
8 import org.simantics.databoard.binding.error.BindingException;
9 import org.simantics.databoard.serialization.Serializer.NonRecursiveSerializer;
11 public class LongSerializer extends NonRecursiveSerializer {
15 public LongSerializer(LongBinding binding) {this.binding = binding;}
18 public Object deserialize(DataInput in) throws IOException{
20 long value = in.readLong();
21 return binding.create(value);
22 } catch (BindingException e) {
23 throw new IOException( e );
28 public void deserializeTo(DataInput in, Object obj) throws IOException {
30 binding.setValue(obj, in.readLong());
31 } catch (BindingException e) {
32 throw new IOException( e );
37 public void skip(DataInput in)
43 public void serialize(DataOutput out, Object obj) throws IOException {
45 long value = binding.getValue_(obj);
46 out.writeLong( value );
47 } catch (BindingException e) {
48 throw new IOException( e );
53 public Integer getConstantSize() {
58 public int getSize(Object obj) {
63 public int getMinSize() {
67 public long getLong(DataInput in) throws IOException
72 public void putLong(DataOutput out, long x) throws IOException