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.IntegerBinding;
8 import org.simantics.databoard.binding.error.BindingException;
9 import org.simantics.databoard.serialization.Serializer.NonRecursiveSerializer;
11 public class IntSerializer extends NonRecursiveSerializer {
13 IntegerBinding binding;
15 public IntSerializer(IntegerBinding binding) { this.binding = binding; }
18 public Object deserialize(DataInput in) throws IOException {
20 int value = in.readInt();
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.readInt());
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 int value = binding.getValue_(obj);
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 int getInt(DataInput in) throws IOException
72 public void putInt(DataOutput out, int x) throws IOException