litesoft
Diff Revisions
811
vs
812
for /trunk/Java/core/Server/src/org/litesoft/filesinksource/FileSinkAndSourceFactory.java
|
@@ -3,8 +3,8 @@ |
3 |
3 |
|
|
4 |
4 |
|
import java.io.*; |
5 |
5 |
|
|
|
6 |
+ |
import org.litesoft.codec.*; |
6 |
7 |
|
import org.litesoft.core.typeutils.*; |
7 |
|
- |
import org.litesoft.core.util.*; |
8 |
8 |
|
import org.litesoft.util.*; |
9 |
9 |
|
|
10 |
10 |
|
public abstract class FileSinkAndSourceFactory |
|
@@ -119,7 +119,7 @@ |
119 |
119 |
|
|
120 |
120 |
|
protected String toString( String pHandlePrefix, String pOpaquePart ) |
121 |
121 |
|
{ |
122 |
|
- |
return pHandlePrefix + encode( pOpaquePart ) + "/" + mDesiredFileName; |
|
122 |
+ |
return pHandlePrefix + HexStringCodec.encode( pOpaquePart ) + "/" + mDesiredFileName; |
123 |
123 |
|
} |
124 |
124 |
|
|
125 |
125 |
|
/** |
|
@@ -133,7 +133,7 @@ |
133 |
133 |
|
int slashAt = zRest.lastIndexOf( '/' ); |
134 |
134 |
|
if ( slashAt != -1 ) |
135 |
135 |
|
{ |
136 |
|
- |
String zOpaquePart = Strings.noEmpty( decode( zRest.substring( 0, slashAt ).trim() ) ); |
|
136 |
+ |
String zOpaquePart = Strings.noEmpty( HexStringCodec.decode( zRest.substring( 0, slashAt ).trim() ) ); |
137 |
137 |
|
String zDesiredFileName = Strings.noEmpty( zRest.substring( slashAt + 1 ) ); |
138 |
138 |
|
if ( (zOpaquePart != null) && (zDesiredFileName != null) ) |
139 |
139 |
|
{ |
|
@@ -143,32 +143,5 @@ |
143 |
143 |
|
} |
144 |
144 |
|
return null; |
145 |
145 |
|
} |
146 |
|
- |
|
147 |
|
- |
private static String encode( String pRegularString ) |
148 |
|
- |
{ |
149 |
|
- |
byte[] zBytes; |
150 |
|
- |
try |
151 |
|
- |
{ |
152 |
|
- |
zBytes = pRegularString.getBytes( FileUtils.UTF_8 ); |
153 |
|
- |
} |
154 |
|
- |
catch ( UnsupportedEncodingException e ) |
155 |
|
- |
{ |
156 |
|
- |
throw new RuntimeException( e ); |
157 |
|
- |
} |
158 |
|
- |
return Hex.toHex( zBytes ); |
159 |
|
- |
} |
160 |
|
- |
|
161 |
|
- |
private static String decode( String pEncodedString ) |
162 |
|
- |
{ |
163 |
|
- |
byte[] zBytes = Hex.fromHex( pEncodedString ); |
164 |
|
- |
try |
165 |
|
- |
{ |
166 |
|
- |
return new String( zBytes, FileUtils.UTF_8 ); |
167 |
|
- |
} |
168 |
|
- |
catch ( UnsupportedEncodingException e ) |
169 |
|
- |
{ |
170 |
|
- |
throw new RuntimeException( e ); |
171 |
|
- |
} |
172 |
|
- |
} |
173 |
146 |
|
} |
174 |
147 |
|
} |