litesoft
Diff Revisions
857
vs
858
for /trunk/Java/core/Anywhere/src/org/litesoft/codec/StringCodecVersion0.java
|
@@ -1,6 +1,7 @@ |
1 |
1 |
|
package org.litesoft.codec; |
2 |
2 |
|
|
3 |
3 |
|
import org.litesoft.charstreams.*; |
|
4 |
+ |
import org.litesoft.core.simpletypes.temporal.*; |
4 |
5 |
|
|
5 |
6 |
|
/** |
6 |
7 |
|
* Implementation that supports an encoding model of encoded Deltas from one |
|
@@ -8,6 +9,18 @@ |
8 |
9 |
|
*/ |
9 |
10 |
|
public class StringCodecVersion0 implements StringCodec |
10 |
11 |
|
{ |
|
12 |
+ |
private final MillisecTimeSource mMillisecTimeSource; |
|
13 |
+ |
|
|
14 |
+ |
public StringCodecVersion0( MillisecTimeSource pMillisecTimeSource ) |
|
15 |
+ |
{ |
|
16 |
+ |
mMillisecTimeSource = MillisecTimeSource.deNull( pMillisecTimeSource ); |
|
17 |
+ |
} |
|
18 |
+ |
|
|
19 |
+ |
public StringCodecVersion0() |
|
20 |
+ |
{ |
|
21 |
+ |
this( null ); |
|
22 |
+ |
} |
|
23 |
+ |
|
11 |
24 |
|
/** |
12 |
25 |
|
* Encode the String. |
13 |
26 |
|
* |
|
@@ -49,7 +62,7 @@ |
49 |
62 |
|
|
50 |
63 |
|
protected char getInitialCharacter() |
51 |
64 |
|
{ |
52 |
|
- |
return SixBitCodec.encode( (int) (63 & System.currentTimeMillis()) ); |
|
65 |
+ |
return SixBitCodec.encode( (int) (63 & mMillisecTimeSource.now()) ); |
53 |
66 |
|
} |
54 |
67 |
|
|
55 |
68 |
|
protected int determinePerCharacterAdjustment( char pInitialCharacter ) |