1 21 22 package org.apache.derby.iapi.services.io; 23 24 import org.apache.derby.iapi.services.io.ArrayInputStream; 25 26 import org.apache.derby.iapi.services.io.FormatIdUtil; 27 import org.apache.derby.iapi.services.io.Formatable; 28 import org.apache.derby.iapi.services.io.StoredFormatIds; 29 30 import java.io.ObjectOutput ; 31 import java.io.ObjectInput ; 32 import java.io.IOException ; 33 34 37 public class FormatableLongHolder implements Formatable 38 { 39 40 private long theLong; 42 43 46 public FormatableLongHolder() 47 { 48 } 49 50 55 public FormatableLongHolder(long theLong) 56 { 57 this.theLong = theLong; 58 } 59 60 65 public void setLong(int theLong) 66 { 67 this.theLong = theLong; 68 } 69 70 75 public long getLong() 76 { 77 return theLong; 78 } 79 80 88 public static FormatableLongHolder[] getFormatableLongHolders(long[] theLongs) 89 { 90 if (theLongs == null) 91 { 92 return null; 93 } 94 95 FormatableLongHolder[] flhArray = new FormatableLongHolder[theLongs.length]; 96 97 for (int index = 0; index < theLongs.length; index++) 98 { 99 flhArray[index] = new FormatableLongHolder(theLongs[index]); 100 } 101 return flhArray; 102 } 103 104 116 public void writeExternal(ObjectOutput out) throws IOException 117 { 118 out.writeLong(theLong); 119 } 120 121 128 public void readExternal(ObjectInput in) 129 throws IOException 130 { 131 theLong = in.readLong(); 132 } 133 public void readExternal(ArrayInputStream in) 134 throws IOException 135 { 136 theLong = in.readLong(); 137 } 138 139 144 public int getTypeFormatId() { return StoredFormatIds.FORMATABLE_LONG_HOLDER_V01_ID; } 145 } 146 | Popular Tags |