Class ObjectTransfer


  • public class ObjectTransfer
    extends java.lang.Object
    Provides static methods for transfering different types of objects over a Data input/output stream.
    Author:
    Tobias Downer
    • Constructor Summary

      Constructors 
      Constructor Description
      ObjectTransfer()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int exactSize​(java.lang.Object ob)
      Returns the exact size an object will take up when serialized.
      static java.lang.Object readFrom​(java.io.DataInputStream in)
      Writes an object from the data input stream.
      static int size​(java.lang.Object ob)
      Makes an estimate of the size of the object.
      static void writeTo​(java.io.DataOutput out, java.lang.Object ob)
      Writes an object to the data output stream.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ObjectTransfer

        public ObjectTransfer()
    • Method Detail

      • size

        public static int size​(java.lang.Object ob)
                        throws java.io.IOException
        Makes an estimate of the size of the object. This is useful for making a guess for how much this will take up.
        Throws:
        java.io.IOException
      • exactSize

        public static int exactSize​(java.lang.Object ob)
                             throws java.io.IOException
        Returns the exact size an object will take up when serialized.
        Throws:
        java.io.IOException
      • writeTo

        public static void writeTo​(java.io.DataOutput out,
                                   java.lang.Object ob)
                            throws java.io.IOException
        Writes an object to the data output stream.
        Throws:
        java.io.IOException
      • readFrom

        public static java.lang.Object readFrom​(java.io.DataInputStream in)
                                         throws java.io.IOException
        Writes an object from the data input stream.
        Throws:
        java.io.IOException