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.ByteBinding;
8 import org.simantics.databoard.binding.error.BindingException;
9 import org.simantics.databoard.serialization.Serializer.NonRecursiveSerializer;
11 public class ByteSerializer extends NonRecursiveSerializer {
15 public ByteSerializer(ByteBinding binding) {
16 this.binding = binding;
20 public Object deserialize(DataInput in) throws IOException {
22 byte value = in.readByte();
23 return binding.create( value );
24 } catch (BindingException e) {
25 throw new IOException( e );
30 public void deserializeTo(DataInput in, Object obj) throws IOException {
32 binding.setValue(obj, in.readByte());
33 } catch (BindingException e) {
34 throw new IOException( e );
39 public void skip(DataInput in)
45 public void serialize(DataOutput out, Object obj) throws IOException {
47 byte value = binding.getValue_(obj);
49 } catch (BindingException e) {
50 throw new IOException( e );
55 public Integer getConstantSize() {
60 public int getSize(Object obj) {
65 public int getMinSize() {
69 public byte getByte(DataInput in) throws IOException
74 public void putByte(DataOutput out, byte x) throws IOException