本文整理汇总了Java中org.apache.harmony.luni.util.Util.decode方法的典型用法代码示例。如果您正苦于以下问题:Java Util.decode方法的具体用法?Java Util.decode怎么用?Java Util.decode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.harmony.luni.util.Util
的用法示例。
在下文中一共展示了Util.decode方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: FileURLConnection
import org.apache.harmony.luni.util.Util; //导入方法依赖的package包/类
/**
* Creates an instance of <code>FileURLConnection</code> for establishing
* a connection to the file pointed by this <code>URL<code>
*
* @param url The URL this connection is connected to
*/
public FileURLConnection(URL url) {
super(url);
fileName = url.getFile();
if (url.getRef() != null) {
fileName += "#" + url.getRef(); //$NON-NLS-1$
}
if (fileName == null) {
fileName = ""; //$NON-NLS-1$
}
String host = url.getHost();
if (host != null && host.length() > 0) {
fileName = "//" + host + fileName; //$NON-NLS-1$
}
fileName = Util.decode(fileName, false);
}
示例2: FileURLConnection
import org.apache.harmony.luni.util.Util; //导入方法依赖的package包/类
/**
* Creates an instance of <code>FileURLConnection</code> for establishing
* a connection to the file pointed by this <code>URL<code>
*
* @param url The URL this connection is connected to
*/
public FileURLConnection(URL url) {
super(url);
fileName = url.getFile();
if (fileName == null) {
fileName = "";
}
fileName = Util.decode(fileName, false);
}
示例3: FileURLConnection
import org.apache.harmony.luni.util.Util; //导入方法依赖的package包/类
/**
* Creates an instance of <code>FileURLConnection</code> for establishing
* a connection to the file pointed by this <code>URL<code>
*
* @param url The URL this connection is connected to
*/
public FileURLConnection(URL url) {
super(url);
fileName = url.getFile();
if (fileName == null) {
fileName = ""; //$NON-NLS-1$
}
fileName = Util.decode(fileName, false);
header = new LinkedHashMap<String, String>();
}
示例4: FileURLConnection
import org.apache.harmony.luni.util.Util; //导入方法依赖的package包/类
/**
* Creates an instance of <code>FileURLConnection</code> for establishing
* a connection to the file pointed by this <code>URL<code>
*
* @param url The URL this connection is connected to
*/
public FileURLConnection(URL url) {
super(url);
fileName = url.getFile();
if (fileName == null) {
fileName = ""; //$NON-NLS-1$
}
fileName = Util.decode(fileName, false, "UTF-8"); //$NON-NLS-1$
header = new LinkedHashMap<String, String>();
}
示例5: openJarFile
import org.apache.harmony.luni.util.Util; //导入方法依赖的package包/类
@SuppressWarnings("nls")
JarFile openJarFile() throws IOException {
JarFile jar = null;
if (jarFileURL.getProtocol().equals("file")) {
jar = new JarFile(new File(Util.decode(jarFileURL.getFile(), false,
"UTF-8")), true, ZipFile.OPEN_READ);
} else {
final InputStream is = jarFileURL.openConnection().getInputStream();
try {
jar = AccessController
.doPrivileged(new PrivilegedAction<JarFile>() {
public JarFile run() {
FileOutputStream fos = null;
JarFile result = null;
try {
File tempJar = File.createTempFile("hyjar_", ".tmp", null);
tempJar.deleteOnExit();
fos = new FileOutputStream(tempJar);
byte[] buf = new byte[4096];
int nbytes = 0;
while ((nbytes = is.read(buf)) > -1) {
fos.write(buf, 0, nbytes);
}
fos.close();
result = new JarFile(tempJar, true,
ZipFile.OPEN_READ | ZipFile.OPEN_DELETE);
} catch (IOException e) {
return null;
} finally {
if (fos != null) {
try {
fos.close();
} catch (IOException ex) {
result = null;
}
}
}
return result;
}
});
} finally {
if (is != null) {
is.close();
}
}
}
return jar;
}
示例6: decode
import org.apache.harmony.luni.util.Util; //导入方法依赖的package包/类
/**
* Decodes the string argument which is assumed to be encoded in the
* <code>x-www-form-urlencoded</code> MIME content type.
* <p>
* '+' will be converted to space, '%' and two following hex digit
* characters are converted to the equivalent byte value. All other
* characters are passed through unmodified.
* <p>
* e.g. "A+B+C %24%25" -> "A B C $%"
*
* @param s
* java.lang.String The encoded string.
* @return java.lang.String The decoded version.
*
* @deprecated use URLDecoder#decode(String, String) instead
*/
@Deprecated
public static String decode(String s) {
return Util.decode(s, true);
}