blob: e2472251c21193c36fa7067b85ac5d4a9f3e7340 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
package org.spongycastle.asn1.eac;
import org.spongycastle.util.Arrays;
/**
* EAC encoding date object
*/
public class PackedDate
{
private byte[] time;
public PackedDate(
String time)
{
this.time = convert(time);
}
private byte[] convert(String sTime)
{
char[] digs = sTime.toCharArray();
byte[] date = new byte[6];
for (int i = 0; i != 6; i++)
{
date[i] = (byte)(digs[i] - '0');
}
return date;
}
PackedDate(
byte[] bytes)
{
this.time = bytes;
}
public int hashCode()
{
return Arrays.hashCode(time);
}
public boolean equals(Object o)
{
if (!(o instanceof PackedDate))
{
return false;
}
PackedDate other = (PackedDate)o;
return Arrays.areEqual(time, other.time);
}
public String toString()
{
char[] dateC = new char[time.length];
for (int i = 0; i != dateC.length; i++)
{
dateC[i] = (char)((time[i] & 0xff) + '0');
}
return new String(dateC);
}
public byte[] getEncoding()
{
return time;
}
}
|