1 23 24 28 29 51 package com.sun.jts.CosTransactions; 52 53 import java.io.*; 54 55 64 class LogRestartDescriptor implements Serializable { 65 68 final static int SIZEOF = 12; 69 70 int restartValid = 0; 71 int restartDataLength = 0; 72 int timeStamp = 0; 73 74 83 LogRestartDescriptor() {} 84 85 96 LogRestartDescriptor(byte[] bytes, int index) { 97 restartValid = (bytes[index++]&255) + 98 ((bytes[index++]&255) << 8) + 99 ((bytes[index++]&255) << 16) + 100 ((bytes[index++]&255) << 24); 101 102 restartDataLength = (bytes[index++]&255) + 103 ((bytes[index++]&255) << 8) + 104 ((bytes[index++]&255) << 16) + 105 ((bytes[index++]&255) << 24); 106 107 timeStamp = (bytes[index++]&255) + 108 ((bytes[index++]&255) << 8) + 109 ((bytes[index++]&255) << 16) + 110 ((bytes[index++]&255) << 24); 111 } 112 113 123 final int toBytes(byte[] bytes, int index) { 124 bytes[index++] = (byte) restartValid; 125 bytes[index++] = (byte)(restartValid >> 8); 126 bytes[index++] = (byte)(restartValid >> 16); 127 bytes[index++] = (byte)(restartValid >> 24); 128 bytes[index++] = (byte) restartDataLength; 129 bytes[index++] = (byte)(restartDataLength >> 8); 130 bytes[index++] = (byte)(restartDataLength >> 16); 131 bytes[index++] = (byte)(restartDataLength >> 24); 132 bytes[index++] = (byte) timeStamp; 133 bytes[index++] = (byte)(timeStamp >> 8); 134 bytes[index++] = (byte)(timeStamp >> 16); 135 bytes[index++] = (byte)(timeStamp >> 24); 136 137 return SIZEOF; 138 } 139 140 149 final boolean equals(LogRestartDescriptor other) { 150 return (restartValid == other.restartValid && 151 restartDataLength == other.restartDataLength && 152 timeStamp == other.timeStamp); 153 } 154 155 165 public final String toString() { 166 return "LRD(valid=" + restartValid + 167 ",len=" + restartDataLength + 168 ",time=" + timeStamp + ")"; 169 } 170 } 171 | Popular Tags |