1 21 22 package org.apache.derby.iapi.services.io; 23 24 import java.io.DataInput ; 25 import java.io.DataOutput ; 26 import java.io.IOException ; 27 28 49 public final class FormatIdUtil 50 { 51 private FormatIdUtil() { 52 } 53 54 public static int getFormatIdByteLength(int formatId) { 55 return 2; 56 } 57 58 public static void writeFormatIdInteger(DataOutput out, int formatId) throws IOException { 59 out.writeShort(formatId); 60 } 61 62 public static int readFormatIdInteger(DataInput in) 63 throws IOException { 64 65 return in.readUnsignedShort(); 66 } 67 68 public static int readFormatIdInteger(byte[] data) { 69 70 int a = data[0]; 71 int b = data[1]; 72 return (((a & 0xff) << 8) | (b & 0xff)); 73 } 74 75 public static String formatIdToString(int fmtId) { 76 77 return Integer.toString(fmtId); 78 } 79 } 80 | Popular Tags |