Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
halo
libcore
Commits
2a6f23ff
Commit
2a6f23ff
authored
11 years ago
by
Elliott Hughes
Browse files
Options
Download
Email Patches
Plain Diff
Add java.nio.charsets.StandardCharsets.
Bug: 3484927 Change-Id: I5820267491b850b8fcc696fa48962710de123009
parent
52ac4053
Changes
27
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
108 additions
and
55 deletions
+108
-55
dalvik/src/main/java/dalvik/system/BlockGuard.java
dalvik/src/main/java/dalvik/system/BlockGuard.java
+0
-1
luni/src/main/java/java/net/InetUnixAddress.java
luni/src/main/java/java/net/InetUnixAddress.java
+3
-3
luni/src/main/java/java/net/Socks4Message.java
luni/src/main/java/java/net/Socks4Message.java
+3
-3
luni/src/main/java/java/net/URLClassLoader.java
luni/src/main/java/java/net/URLClassLoader.java
+2
-2
luni/src/main/java/java/net/URLEncoder.java
luni/src/main/java/java/net/URLEncoder.java
+2
-2
luni/src/main/java/java/nio/charset/StandardCharsets.java
luni/src/main/java/java/nio/charset/StandardCharsets.java
+56
-0
luni/src/main/java/java/util/ResourceBundle.java
luni/src/main/java/java/util/ResourceBundle.java
+2
-3
luni/src/main/java/java/util/jar/InitManifest.java
luni/src/main/java/java/util/jar/InitManifest.java
+3
-3
luni/src/main/java/java/util/jar/JarVerifier.java
luni/src/main/java/java/util/jar/JarVerifier.java
+3
-3
luni/src/main/java/java/util/jar/Manifest.java
luni/src/main/java/java/util/jar/Manifest.java
+3
-3
luni/src/main/java/java/util/prefs/AbstractPreferences.java
luni/src/main/java/java/util/prefs/AbstractPreferences.java
+2
-2
luni/src/main/java/java/util/zip/ZipEntry.java
luni/src/main/java/java/util/zip/ZipEntry.java
+4
-4
luni/src/main/java/java/util/zip/ZipOutputStream.java
luni/src/main/java/java/util/zip/ZipOutputStream.java
+4
-4
luni/src/main/java/libcore/io/Base64.java
luni/src/main/java/libcore/io/Base64.java
+2
-2
luni/src/main/java/libcore/io/IoUtils.java
luni/src/main/java/libcore/io/IoUtils.java
+2
-2
luni/src/main/java/libcore/io/StrictLineReader.java
luni/src/main/java/libcore/io/StrictLineReader.java
+4
-5
luni/src/main/java/libcore/net/UriCodec.java
luni/src/main/java/libcore/net/UriCodec.java
+4
-4
luni/src/main/java/libcore/net/url/FtpURLConnection.java
luni/src/main/java/libcore/net/url/FtpURLConnection.java
+3
-3
luni/src/main/java/libcore/util/ZoneInfoDB.java
luni/src/main/java/libcore/util/ZoneInfoDB.java
+4
-4
luni/src/main/java/org/apache/harmony/security/asn1/ASN1GeneralizedTime.java
...org/apache/harmony/security/asn1/ASN1GeneralizedTime.java
+2
-2
No files found.
dalvik/src/main/java/dalvik/system/BlockGuard.java
View file @
2a6f23ff
...
...
@@ -22,7 +22,6 @@ import java.io.FileOutputStream;
import
java.io.IOException
;
import
java.math.BigInteger
;
import
java.net.SocketException
;
import
java.nio.charset.Charsets
;
/**
* Mechanism to let threads set restrictions on what code is allowed
...
...
This diff is collapsed.
Click to expand it.
luni/src/main/java/java/net/InetUnixAddress.java
View file @
2a6f23ff
...
...
@@ -16,7 +16,7 @@
package
java.net
;
import
java.nio.charset.Charsets
;
import
java.nio.charset.
Standard
Charsets
;
import
static
libcore
.
io
.
OsConstants
.*;
...
...
@@ -29,7 +29,7 @@ public final class InetUnixAddress extends InetAddress {
* Constructs an AF_UNIX InetAddress for the given path.
*/
public
InetUnixAddress
(
String
path
)
{
this
(
path
.
getBytes
(
Charsets
.
UTF_8
));
this
(
path
.
getBytes
(
Standard
Charsets
.
UTF_8
));
}
/**
...
...
@@ -43,6 +43,6 @@ public final class InetUnixAddress extends InetAddress {
* Returns a string form of this InetAddress.
*/
@Override
public
String
toString
()
{
return
"InetUnixAddress["
+
new
String
(
ipaddress
,
Charsets
.
UTF_8
)
+
"]"
;
return
"InetUnixAddress["
+
new
String
(
ipaddress
,
Standard
Charsets
.
UTF_8
)
+
"]"
;
}
}
This diff is collapsed.
Click to expand it.
luni/src/main/java/java/net/Socks4Message.java
View file @
2a6f23ff
...
...
@@ -18,7 +18,7 @@
package
java.net
;
import
java.nio.ByteOrder
;
import
java.nio.charset.Charsets
;
import
java.nio.charset.
Standard
Charsets
;
import
libcore.io.Memory
;
class
Socks4Message
{
...
...
@@ -188,7 +188,7 @@ class Socks4Message {
while
(
index
<
lastIndex
&&
(
buffer
[
index
]
!=
0
))
{
index
++;
}
return
new
String
(
buffer
,
offset
,
index
-
offset
,
Charsets
.
ISO_8859_1
);
return
new
String
(
buffer
,
offset
,
index
-
offset
,
Standard
Charsets
.
ISO_8859_1
);
}
/**
...
...
@@ -202,7 +202,7 @@ class Socks4Message {
* Put a string into the buffer at the offset given.
*/
private
void
setString
(
int
offset
,
int
maxLength
,
String
theString
)
{
byte
[]
stringBytes
=
theString
.
getBytes
(
Charsets
.
ISO_8859_1
);
byte
[]
stringBytes
=
theString
.
getBytes
(
Standard
Charsets
.
ISO_8859_1
);
int
length
=
Math
.
min
(
stringBytes
.
length
,
maxLength
);
System
.
arraycopy
(
stringBytes
,
0
,
buffer
,
offset
,
length
);
buffer
[
offset
+
length
]
=
0
;
...
...
This diff is collapsed.
Click to expand it.
luni/src/main/java/java/net/URLClassLoader.java
View file @
2a6f23ff
...
...
@@ -26,7 +26,7 @@ import java.io.IOException;
import
java.io.InputStream
;
import
java.io.InputStreamReader
;
import
java.io.UnsupportedEncodingException
;
import
java.nio.charset.Charsets
;
import
java.nio.charset.
Standard
Charsets
;
import
java.security.CodeSource
;
import
java.security.PermissionCollection
;
import
java.security.SecureClassLoader
;
...
...
@@ -76,7 +76,7 @@ public class URLClassLoader extends SecureClassLoader {
String
parentURLString
=
getParentURL
(
url
).
toExternalForm
();
String
prefix
=
"jar:"
+
parentURLString
+
"/"
;
is
=
jf
.
getInputStream
(
indexEntry
);
in
=
new
BufferedReader
(
new
InputStreamReader
(
is
,
Charsets
.
UTF_8
));
in
=
new
BufferedReader
(
new
InputStreamReader
(
is
,
Standard
Charsets
.
UTF_8
));
HashMap
<
String
,
ArrayList
<
URL
>>
pre_map
=
new
HashMap
<
String
,
ArrayList
<
URL
>>();
// Ignore the 2 first lines (index version)
if
(
in
.
readLine
()
==
null
)
return
null
;
...
...
This diff is collapsed.
Click to expand it.
luni/src/main/java/java/net/URLEncoder.java
View file @
2a6f23ff
...
...
@@ -19,7 +19,7 @@ package java.net;
import
java.io.UnsupportedEncodingException
;
import
java.nio.charset.Charset
;
import
java.nio.charset.Charsets
;
import
java.nio.charset.
Standard
Charsets
;
import
libcore.net.UriCodec
;
/**
...
...
@@ -47,7 +47,7 @@ public class URLEncoder {
*/
@Deprecated
public
static
String
encode
(
String
s
)
{
return
ENCODER
.
encode
(
s
,
Charsets
.
UTF_8
);
return
ENCODER
.
encode
(
s
,
Standard
Charsets
.
UTF_8
);
}
/**
...
...
This diff is collapsed.
Click to expand it.
luni/src/main/java/java/nio/charset/StandardCharsets.java
0 → 100644
View file @
2a6f23ff
/*
* Copyright (C) 2010 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
java.nio.charset
;
/**
* Convenient access to the most important built-in charsets.
* @since 1.7
*/
public
final
class
StandardCharsets
{
private
StandardCharsets
()
{
}
/**
* The ISO-8859-1 charset.
*/
public
static
final
Charset
ISO_8859_1
=
Charset
.
forName
(
"ISO-8859-1"
);
/**
* The US-ASCII charset.
*/
public
static
final
Charset
US_ASCII
=
Charset
.
forName
(
"US-ASCII"
);
/**
* The UTF-8 charset.
*/
public
static
final
Charset
UTF_8
=
Charset
.
forName
(
"UTF-8"
);
/**
* The UTF-16 charset.
*/
public
static
final
Charset
UTF_16
=
Charset
.
forName
(
"UTF-16"
);
/**
* The UTF-16BE (big-endian) charset.
*/
public
static
final
Charset
UTF_16BE
=
Charset
.
forName
(
"UTF-16BE"
);
/**
* The UTF-16LE (little-endian) charset.
*/
public
static
final
Charset
UTF_16LE
=
Charset
.
forName
(
"UTF-16LE"
);
}
This diff is collapsed.
Click to expand it.
luni/src/main/java/java/util/ResourceBundle.java
View file @
2a6f23ff
...
...
@@ -24,8 +24,7 @@ import java.io.InputStream;
import
java.io.InputStreamReader
;
import
java.net.URL
;
import
java.net.URLConnection
;
import
java.nio.charset.Charsets
;
import
static
java
.
nio
.
charset
.
Charsets
.
UTF_8
;
import
java.nio.charset.StandardCharsets
;
import
libcore.io.IoUtils
;
/**
...
...
@@ -518,7 +517,7 @@ public abstract class ResourceBundle {
:
ClassLoader
.
getSystemResourceAsStream
(
fileName
);
if
(
stream
!=
null
)
{
try
{
bundle
=
new
PropertyResourceBundle
(
new
InputStreamReader
(
stream
,
UTF_8
));
bundle
=
new
PropertyResourceBundle
(
new
InputStreamReader
(
stream
,
StandardCharsets
.
UTF_8
));
bundle
.
setLocale
(
locale
);
}
catch
(
IOException
ignored
)
{
}
finally
{
...
...
This diff is collapsed.
Click to expand it.
luni/src/main/java/java/util/jar/InitManifest.java
View file @
2a6f23ff
...
...
@@ -18,7 +18,7 @@
package
java.util.jar
;
import
java.io.IOException
;
import
java.nio.charset.Charsets
;
import
java.nio.charset.
Standard
Charsets
;
import
java.util.Map
;
/**
...
...
@@ -110,7 +110,7 @@ class InitManifest {
continue
;
}
String
name
=
new
String
(
buf
,
mark
,
pos
-
mark
-
1
,
Charsets
.
US_ASCII
);
String
name
=
new
String
(
buf
,
mark
,
pos
-
mark
-
1
,
Standard
Charsets
.
US_ASCII
);
if
(
buf
[
pos
++]
!=
' '
)
{
throw
new
IOException
(
String
.
format
(
"Invalid value for attribute '%s'"
,
name
));
...
...
@@ -164,6 +164,6 @@ class InitManifest {
}
valueBuffer
.
write
(
buf
,
mark
,
last
-
mark
);
value
=
valueBuffer
.
toString
(
Charsets
.
UTF_8
);
value
=
valueBuffer
.
toString
(
Standard
Charsets
.
UTF_8
);
}
}
This diff is collapsed.
Click to expand it.
luni/src/main/java/java/util/jar/JarVerifier.java
View file @
2a6f23ff
...
...
@@ -20,7 +20,7 @@ package java.util.jar;
import
java.io.ByteArrayInputStream
;
import
java.io.IOException
;
import
java.io.OutputStream
;
import
java.nio.charset.Charsets
;
import
java.nio.charset.
Standard
Charsets
;
import
java.security.GeneralSecurityException
;
import
java.security.MessageDigest
;
import
java.security.NoSuchAlgorithmException
;
...
...
@@ -206,7 +206,7 @@ class JarVerifier {
if
(
hash
==
null
)
{
continue
;
}
byte
[]
hashBytes
=
hash
.
getBytes
(
Charsets
.
ISO_8859_1
);
byte
[]
hashBytes
=
hash
.
getBytes
(
Standard
Charsets
.
ISO_8859_1
);
try
{
return
new
VerifierEntry
(
name
,
MessageDigest
.
getInstance
(
algorithm
),
hashBytes
,
...
...
@@ -408,7 +408,7 @@ class JarVerifier {
md
.
update
(
data
,
start
,
end
-
start
);
}
byte
[]
b
=
md
.
digest
();
byte
[]
hashBytes
=
hash
.
getBytes
(
Charsets
.
ISO_8859_1
);
byte
[]
hashBytes
=
hash
.
getBytes
(
Standard
Charsets
.
ISO_8859_1
);
return
MessageDigest
.
isEqual
(
b
,
Base64
.
decode
(
hashBytes
));
}
return
ignorable
;
...
...
This diff is collapsed.
Click to expand it.
luni/src/main/java/java/util/jar/Manifest.java
View file @
2a6f23ff
...
...
@@ -25,8 +25,8 @@ import java.lang.reflect.Field;
import
java.nio.ByteBuffer
;
import
java.nio.CharBuffer
;
import
java.nio.charset.CharsetEncoder
;
import
java.nio.charset.Charsets
;
import
java.nio.charset.CoderResult
;
import
java.nio.charset.StandardCharsets
;
import
java.util.HashMap
;
import
java.util.Iterator
;
import
java.util.Map
;
...
...
@@ -302,7 +302,7 @@ public class Manifest implements Cloneable {
* If an error occurs writing the {@code Manifest}.
*/
static
void
write
(
Manifest
manifest
,
OutputStream
out
)
throws
IOException
{
CharsetEncoder
encoder
=
Charsets
.
UTF_8
.
newEncoder
();
CharsetEncoder
encoder
=
Standard
Charsets
.
UTF_8
.
newEncoder
();
ByteBuffer
buffer
=
ByteBuffer
.
allocate
(
LINE_LENGTH_LIMIT
);
Attributes
.
Name
versionName
=
Attributes
.
Name
.
MANIFEST_VERSION
;
...
...
@@ -339,7 +339,7 @@ public class Manifest implements Cloneable {
private
static
void
writeEntry
(
OutputStream
os
,
Attributes
.
Name
name
,
String
value
,
CharsetEncoder
encoder
,
ByteBuffer
bBuf
)
throws
IOException
{
String
nameString
=
name
.
getName
();
os
.
write
(
nameString
.
getBytes
(
Charsets
.
US_ASCII
));
os
.
write
(
nameString
.
getBytes
(
Standard
Charsets
.
US_ASCII
));
os
.
write
(
VALUE_SEPARATOR
);
encoder
.
reset
();
...
...
This diff is collapsed.
Click to expand it.
luni/src/main/java/java/util/prefs/AbstractPreferences.java
View file @
2a6f23ff
...
...
@@ -19,7 +19,7 @@ package java.util.prefs;
import
java.io.IOException
;
import
java.io.OutputStream
;
import
java.nio.charset.Charsets
;
import
java.nio.charset.
Standard
Charsets
;
import
java.util.Collection
;
import
java.util.EventListener
;
import
java.util.EventObject
;
...
...
@@ -441,7 +441,7 @@ public abstract class AbstractPreferences extends Preferences {
return
EmptyArray
.
BYTE
;
}
try
{
byte
[]
bavalue
=
svalue
.
getBytes
(
Charsets
.
US_ASCII
);
byte
[]
bavalue
=
svalue
.
getBytes
(
Standard
Charsets
.
US_ASCII
);
if
(
bavalue
.
length
%
4
!=
0
)
{
return
deflt
;
}
...
...
This diff is collapsed.
Click to expand it.
luni/src/main/java/java/util/zip/ZipEntry.java
View file @
2a6f23ff
...
...
@@ -20,7 +20,7 @@ package java.util.zip;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.nio.ByteOrder
;
import
java.nio.charset.Charsets
;
import
java.nio.charset.
Standard
Charsets
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.GregorianCalendar
;
...
...
@@ -184,7 +184,7 @@ public class ZipEntry implements ZipConstants, Cloneable {
return
;
}
byte
[]
commentBytes
=
comment
.
getBytes
(
Charsets
.
UTF_8
);
byte
[]
commentBytes
=
comment
.
getBytes
(
Standard
Charsets
.
UTF_8
);
if
(
commentBytes
.
length
>
0xffff
)
{
throw
new
IllegalArgumentException
(
"Comment too long: "
+
commentBytes
.
length
);
}
...
...
@@ -383,14 +383,14 @@ public class ZipEntry implements ZipConstants, Cloneable {
byte
[]
nameBytes
=
new
byte
[
nameLength
];
Streams
.
readFully
(
in
,
nameBytes
,
0
,
nameBytes
.
length
);
name
=
new
String
(
nameBytes
,
0
,
nameBytes
.
length
,
Charsets
.
UTF_8
);
name
=
new
String
(
nameBytes
,
0
,
nameBytes
.
length
,
Standard
Charsets
.
UTF_8
);
// The RI has always assumed UTF-8. (If GPBF_UTF8_FLAG isn't set, the encoding is
// actually IBM-437.)
if
(
commentByteCount
>
0
)
{
byte
[]
commentBytes
=
new
byte
[
commentByteCount
];
Streams
.
readFully
(
in
,
commentBytes
,
0
,
commentByteCount
);
comment
=
new
String
(
commentBytes
,
0
,
commentBytes
.
length
,
Charsets
.
UTF_8
);
comment
=
new
String
(
commentBytes
,
0
,
commentBytes
.
length
,
Standard
Charsets
.
UTF_8
);
}
if
(
extraLength
>
0
)
{
...
...
This diff is collapsed.
Click to expand it.
luni/src/main/java/java/util/zip/ZipOutputStream.java
View file @
2a6f23ff
...
...
@@ -20,7 +20,7 @@ package java.util.zip;
import
java.io.ByteArrayOutputStream
;
import
java.io.IOException
;
import
java.io.OutputStream
;
import
java.nio.charset.Charsets
;
import
java.nio.charset.
Standard
Charsets
;
import
java.util.Arrays
;
import
java.util.HashSet
;
import
libcore.util.EmptyArray
;
...
...
@@ -182,7 +182,7 @@ public class ZipOutputStream extends DeflaterOutputStream implements ZipConstant
String
comment
=
currentEntry
.
getComment
();
byte
[]
commentBytes
=
EmptyArray
.
BYTE
;
if
(
comment
!=
null
)
{
commentBytes
=
comment
.
getBytes
(
Charsets
.
UTF_8
);
commentBytes
=
comment
.
getBytes
(
Standard
Charsets
.
UTF_8
);
}
writeShort
(
cDir
,
commentBytes
.
length
);
// Comment length.
writeShort
(
cDir
,
0
);
// Disk Start
...
...
@@ -294,7 +294,7 @@ public class ZipOutputStream extends DeflaterOutputStream implements ZipConstant
// TODO: support Zip64.
throw
new
ZipException
(
"Too many entries for the zip file format's 16-bit entry count"
);
}
nameBytes
=
ze
.
name
.
getBytes
(
Charsets
.
UTF_8
);
nameBytes
=
ze
.
name
.
getBytes
(
Standard
Charsets
.
UTF_8
);
nameLength
=
nameBytes
.
length
;
if
(
nameLength
>
0xffff
)
{
throw
new
IllegalArgumentException
(
"Name too long: "
+
nameLength
+
" UTF-8 bytes"
);
...
...
@@ -353,7 +353,7 @@ public class ZipOutputStream extends DeflaterOutputStream implements ZipConstant
return
;
}
byte
[]
newCommentBytes
=
comment
.
getBytes
(
Charsets
.
UTF_8
);
byte
[]
newCommentBytes
=
comment
.
getBytes
(
Standard
Charsets
.
UTF_8
);
if
(
newCommentBytes
.
length
>
0xffff
)
{
throw
new
IllegalArgumentException
(
"Comment too long: "
+
newCommentBytes
.
length
+
" bytes"
);
}
...
...
This diff is collapsed.
Click to expand it.
luni/src/main/java/libcore/io/Base64.java
View file @
2a6f23ff
...
...
@@ -21,7 +21,7 @@
package
libcore.io
;
import
java.nio.charset.Charsets
;
import
java.nio.charset.
Standard
Charsets
;
import
libcore.util.EmptyArray
;
/**
...
...
@@ -156,6 +156,6 @@ public final class Base64 {
out
[
index
++]
=
'='
;
break
;
}
return
new
String
(
out
,
0
,
index
,
Charsets
.
US_ASCII
);
return
new
String
(
out
,
0
,
index
,
Standard
Charsets
.
US_ASCII
);
}
}
This diff is collapsed.
Click to expand it.
luni/src/main/java/libcore/io/IoUtils.java
View file @
2a6f23ff
...
...
@@ -22,7 +22,7 @@ import java.io.IOException;
import
java.io.InterruptedIOException
;
import
java.io.RandomAccessFile
;
import
java.net.Socket
;
import
java.nio.charset.Charsets
;
import
java.nio.charset.
Standard
Charsets
;
import
java.util.Random
;
import
static
libcore
.
io
.
OsConstants
.*;
...
...
@@ -110,7 +110,7 @@ public final class IoUtils {
* Returns the contents of 'path' as a string. The contents are assumed to be UTF-8.
*/
public
static
String
readFileAsString
(
String
path
)
throws
IOException
{
return
readFileAsBytes
(
path
).
toString
(
Charsets
.
UTF_8
);
return
readFileAsBytes
(
path
).
toString
(
Standard
Charsets
.
UTF_8
);
}
private
static
UnsafeByteSequence
readFileAsBytes
(
String
path
)
throws
IOException
{
...
...
This diff is collapsed.
Click to expand it.
luni/src/main/java/libcore/io/StrictLineReader.java
View file @
2a6f23ff
...
...
@@ -22,7 +22,7 @@ import java.io.EOFException;
import
java.io.InputStream
;
import
java.io.IOException
;
import
java.nio.charset.Charset
;
import
java.nio.charset.Charsets
;
import
java.nio.charset.
Standard
Charsets
;
/**
* Buffers input from an {@link InputStream} for reading lines.
...
...
@@ -78,7 +78,7 @@ public class StrictLineReader implements Closeable {
* @throws IllegalArgumentException for negative or zero {@code capacity}.
*/
public
StrictLineReader
(
InputStream
in
,
int
capacity
)
{
this
(
in
,
capacity
,
Charsets
.
US_ASCII
);
this
(
in
,
capacity
,
Standard
Charsets
.
US_ASCII
);
}
/**
...
...
@@ -114,8 +114,8 @@ public class StrictLineReader implements Closeable {
if
(
capacity
<
0
)
{
throw
new
IllegalArgumentException
(
"capacity <= 0"
);
}
if
(!(
charset
.
equals
(
Charsets
.
US_ASCII
)
||
charset
.
equals
(
Charsets
.
UTF_8
)
||
charset
.
equals
(
Charsets
.
ISO_8859_1
)))
{
if
(!(
charset
.
equals
(
Standard
Charsets
.
US_ASCII
)
||
charset
.
equals
(
Standard
Charsets
.
UTF_8
)
||
charset
.
equals
(
Standard
Charsets
.
ISO_8859_1
)))
{
throw
new
IllegalArgumentException
(
"Unsupported encoding"
);
}
...
...
@@ -240,4 +240,3 @@ public class StrictLineReader implements Closeable {
end
=
result
;
}
}
This diff is collapsed.
Click to expand it.
luni/src/main/java/libcore/net/UriCodec.java
View file @
2a6f23ff
...
...
@@ -20,7 +20,7 @@ package libcore.net;
import
java.io.ByteArrayOutputStream
;
import
java.net.URISyntaxException
;
import
java.nio.charset.Charset
;
import
java.nio.charset.Charsets
;
import
java.nio.charset.
Standard
Charsets
;
/**
* Encodes and decodes {@code application/x-www-form-urlencoded} content.
...
...
@@ -135,11 +135,11 @@ public abstract class UriCodec {
}
public
final
void
appendEncoded
(
StringBuilder
builder
,
String
s
)
{
appendEncoded
(
builder
,
s
,
Charsets
.
UTF_8
,
false
);
appendEncoded
(
builder
,
s
,
Standard
Charsets
.
UTF_8
,
false
);
}
public
final
void
appendPartiallyEncoded
(
StringBuilder
builder
,
String
s
)
{
appendEncoded
(
builder
,
s
,
Charsets
.
UTF_8
,
true
);
appendEncoded
(
builder
,
s
,
Standard
Charsets
.
UTF_8
,
true
);
}
/**
...
...
@@ -203,7 +203,7 @@ public abstract class UriCodec {
}
public
static
String
decode
(
String
s
)
{
return
decode
(
s
,
false
,
Charsets
.
UTF_8
,
true
);
return
decode
(
s
,
false
,
Standard
Charsets
.
UTF_8
,
true
);
}
private
static
void
appendHex
(
StringBuilder
builder
,
String
s
,
Charset
charset
)
{
...
...
This diff is collapsed.
Click to expand it.
luni/src/main/java/libcore/net/url/FtpURLConnection.java
View file @
2a6f23ff
...
...
@@ -35,7 +35,7 @@ import java.net.URISyntaxException;
import
java.net.URL
;
import
java.net.URLConnection
;
import
java.net.URLStreamHandler
;
import
java.nio.charset.Charsets
;
import
java.nio.charset.
Standard
Charsets
;
import
java.security.Permission
;
import
java.util.ArrayList
;
import
java.util.Iterator
;
...
...
@@ -350,7 +350,7 @@ public class FtpURLConnection extends URLConnection {
}
code
[
i
]
=
(
byte
)
tmp
;
}
replyCode
=
new
String
(
code
,
0
,
code
.
length
,
Charsets
.
ISO_8859_1
);
replyCode
=
new
String
(
code
,
0
,
code
.
length
,
Standard
Charsets
.
ISO_8859_1
);
boolean
multiline
=
false
;
if
(
ctrlInput
.
read
()
==
'-'
)
{
...
...
@@ -497,6 +497,6 @@ public class FtpURLConnection extends URLConnection {
}
private
void
write
(
String
command
)
throws
IOException
{
ctrlOutput
.
write
(
command
.
getBytes
(
Charsets
.
ISO_8859_1
));
ctrlOutput
.
write
(
command
.
getBytes
(
Standard
Charsets
.
ISO_8859_1
));
}
}
This diff is collapsed.
Click to expand it.
luni/src/main/java/libcore/util/ZoneInfoDB.java
View file @
2a6f23ff
...
...
@@ -21,7 +21,7 @@ import java.io.RandomAccessFile;
import
java.nio.ByteBuffer
;
import
java.nio.ByteOrder
;
import
java.nio.channels.FileChannel.MapMode
;
import
java.nio.charset.Charsets
;
import
java.nio.charset.
Standard
Charsets
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
...
...
@@ -111,11 +111,11 @@ public final class ZoneInfoDB {
byte
[]
tzdata_version
=
new
byte
[
12
];
it
.
readByteArray
(
tzdata_version
,
0
,
tzdata_version
.
length
);
String
magic
=
new
String
(
tzdata_version
,
0
,
6
,
Charsets
.
US_ASCII
);
String
magic
=
new
String
(
tzdata_version
,
0
,
6
,
Standard
Charsets
.
US_ASCII
);
if
(!
magic
.
equals
(
"tzdata"
)
||
tzdata_version
[
11
]
!=
0
)
{
throw
new
RuntimeException
(
"bad tzdata magic: "
+
Arrays
.
toString
(
tzdata_version
));
}
version
=
new
String
(
tzdata_version
,
6
,
5
,
Charsets
.
US_ASCII
);
version
=
new
String
(
tzdata_version
,
6
,
5
,
Standard
Charsets
.
US_ASCII
);
int
index_offset
=
it
.
readInt
();
int
data_offset
=
it
.
readInt
();
...
...
@@ -129,7 +129,7 @@ public final class ZoneInfoDB {
byte
[]
bytes
=
new
byte
[
zoneTabSize
];
it
.
seek
(
zoneTabOffset
);
it
.
readByteArray
(
bytes
,
0
,
bytes
.
length
);
zoneTab
=
new
String
(
bytes
,
0
,
bytes
.
length
,
Charsets
.
US_ASCII
);
zoneTab
=
new
String
(
bytes
,
0
,
bytes
.
length
,
Standard
Charsets
.
US_ASCII
);
}
private
void
readIndex
(
BufferIterator
it
,
int
indexOffset
,
int
dataOffset
)
{
...
...
This diff is collapsed.
Click to expand it.
luni/src/main/java/org/apache/harmony/security/asn1/ASN1GeneralizedTime.java
View file @
2a6f23ff
...
...
@@ -23,7 +23,7 @@
package
org.apache.harmony.security.asn1
;
import
java.io.IOException
;
import
java.nio.charset.Charsets
;
import
java.nio.charset.
Standard
Charsets
;
import
java.text.SimpleDateFormat
;
import
java.util.Locale
;
import
java.util.TimeZone
;
...
...
@@ -99,7 +99,7 @@ public final class ASN1GeneralizedTime extends ASN1Time {
temp
=
temp
.
substring
(
0
,
currLength
);
}
out
.
content
=
(
temp
+
"Z"
).
getBytes
(
Charsets
.
UTF_8
);
out
.
content
=
(
temp
+
"Z"
).
getBytes
(
Standard
Charsets
.
UTF_8
);
out
.
length
=
((
byte
[])
out
.
content
).
length
;
}
}
This diff is collapsed.
Click to expand it.
Prev
1
2
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment