Home
last modified time | relevance | path

Searched refs:bytes (Results 1 – 25 of 146) sorted by relevance

123456

/libcore/luni/src/main/java/libcore/icu/
DCollationKeyICU.java22 private final byte[] bytes; field in CollationKeyICU
29 CollationKeyICU(String source, byte[] bytes) { in CollationKeyICU() argument
31 this.bytes = bytes; in CollationKeyICU()
38 rhsBytes = ((CollationKeyICU) other).bytes; in compareTo()
43 if (bytes == null || bytes.length == 0) { in compareTo()
54 int count = Math.min(bytes.length, rhsBytes.length); in compareTo()
56 int s = bytes[i] & 0xff; in compareTo()
65 if (bytes.length < rhsBytes.length) { in compareTo()
68 if (bytes.length > rhsBytes.length) { in compareTo()
96 if (bytes != null && bytes.length != 0) { in hashCode()
[all …]
/libcore/luni/src/test/java/libcore/java/io/
DOutputStreamWriterTest.java66 byte[] bytes = baos.toByteArray(); in testFlush()
67 assertEquals(8196, bytes.length); in testFlush()
70 assertEquals((byte) 0, bytes[i++]); in testFlush()
71 assertEquals((byte) 0, bytes[i++]); in testFlush()
72 assertEquals((byte) 0, bytes[i++]); in testFlush()
73 assertEquals((byte) 'x', bytes[i++]); in testFlush()
77 assertEquals((byte) 0x00, bytes[i++]); in testFlush() local
78 assertEquals((byte) 0x02, bytes[i++]); in testFlush() local
79 assertEquals((byte) 0x0b, bytes[i++]); in testFlush() local
80 assertEquals((byte) 0x9f, bytes[i++]); in testFlush() local
[all …]
DDataOutputStreamTest.java26 private ByteArrayOutputStream bytes = new ByteArrayOutputStream(); field in DataOutputStreamTest
27 private DataOutputStream os = new DataOutputStream(bytes);
32 assertEquals("[01, 00]", toHexString(bytes.toByteArray())); in test_writeBoolean()
42 assertEquals("[ff, 00, 01, 81, 34]", toHexString(bytes.toByteArray())); in test_writeByte()
48 assertEquals("[30, 34, 31]", toHexString(bytes.toByteArray())); in test_writeBytes()
55 assertEquals("[00, 30, 12, 34]", toHexString(bytes.toByteArray())); in test_writeChar()
61 assertEquals("[00, 30, 12, 34, 00, 31]", toHexString(bytes.toByteArray())); in test_writeChars()
66 assertEquals("[01, 23, 45, 67, 89, ab, cd, ef]", toHexString(bytes.toByteArray())); in test_writeDouble()
71 assertEquals("[01, 23, 45, 67]", toHexString(bytes.toByteArray())); in test_writeFloat()
76 assertEquals("[01, 23, 45, 67]", toHexString(bytes.toByteArray())); in test_writeInt()
[all …]
/libcore/luni/src/main/java/java/io/
DInputStreamReader.java45 private final ByteBuffer bytes = ByteBuffer.allocate(8192); field in InputStreamReader
90 bytes.limit(0); in InputStreamReader()
107 bytes.limit(0); in InputStreamReader()
125 bytes.limit(0); in InputStreamReader()
215 boolean needInput = !bytes.hasRemaining(); in read()
229 int desiredByteCount = bytes.capacity() - bytes.limit(); in read()
230 int off = bytes.arrayOffset() + bytes.limit(); in read()
231 int actualByteCount = in.read(bytes.array(), off, desiredByteCount); in read()
239 bytes.limit(bytes.limit() + actualByteCount); in read()
244 result = decoder.decode(bytes, out, false); in read()
[all …]
DOutputStreamWriter.java44 private ByteBuffer bytes = ByteBuffer.allocate(8192); field in OutputStreamWriter
143 bytes = null; in close()
164 int position = bytes.position(); in flushBytes()
166 bytes.flip(); in flushBytes()
167 out.write(bytes.array(), bytes.arrayOffset(), position); in flushBytes()
168 bytes.clear(); in flushBytes()
178 CoderResult result = encoder.encode(chars, bytes, false); in convert()
197 CoderResult result = encoder.encode(chars, bytes, true); in drainEncoder()
210 CoderResult result = encoder.flush(bytes); in drainEncoder()
214 result = encoder.flush(bytes); in drainEncoder()
DDataOutputStream.java152 byte[] bytes = new byte[str.length()]; in writeBytes()
154 bytes[index] = (byte) str.charAt(index); in writeBytes()
156 out.write(bytes); in writeBytes()
157 written += bytes.length; in writeBytes()
165 byte[] bytes = str.getBytes("UTF-16BE"); in writeChars()
166 out.write(bytes); in writeChars()
167 written += bytes.length; in writeChars()
/libcore/luni/src/main/java/org/apache/harmony/security/asn1/
DBitString.java38 public final byte[] bytes; field in BitString
49 public BitString(byte[] bytes, int unusedBits) { in BitString() argument
55 if (bytes.length == 0 && unusedBits != 0) { in BitString()
59 this.bytes = bytes; in BitString()
69 bytes = new byte[size]; in BitString()
78 return (bytes[index] & SET_MASK[offset]) != 0; in getBit()
85 bytes[index] |= SET_MASK[offset]; in setBit()
87 bytes[index] &= RESET_MASK[offset]; in setBit()
92 boolean[] result = new boolean[bytes.length * 8 - unusedBits]; in toBooleanArray()
DASN1BitString.java79 byte[] bytes = new byte[in.length - 1]; in getDecodedObject()
80 System.arraycopy(in.buffer, in.contentOffset + 1, bytes, 0, in getDecodedObject()
82 return new BitString(bytes, in.buffer[in.contentOffset]); in getDecodedObject()
90 out.length = ((BitString) out.content).bytes.length + 1; in setEncodingContent()
172 byte[] bytes = new byte[index / 8 + 1]; in setEncodingContent()
175 index = bytes.length - 1; in setEncodingContent()
179 bytes[i] = (byte) (bytes[i] | SET_MASK[k]); in setEncodingContent()
187 bytes[index] = (byte) (bytes[index] | SET_MASK[k]); in setEncodingContent()
191 out.content = new BitString(bytes, unusedBits); in setEncodingContent()
192 out.length = bytes.length + 1; in setEncodingContent()
DASN1StringType.java47 byte[] bytes = ((String) out.content).getBytes(StandardCharsets.UTF_8); in setEncodingContent()
48 out.content = bytes; in setEncodingContent()
49 out.length = bytes.length; in setEncodingContent()
112 byte[] bytes = ((String) out.content).getBytes(StandardCharsets.UTF_8); in setEncodingContent()
113 out.content = bytes; in setEncodingContent()
114 out.length = bytes.length; in setEncodingContent()
/libcore/dex/src/main/java/com/android/dex/util/
DByteArrayByteInput.java21 private final byte[] bytes; field in ByteArrayByteInput
24 public ByteArrayByteInput(byte... bytes) { in ByteArrayByteInput() argument
25 this.bytes = bytes; in ByteArrayByteInput()
29 return bytes[position++]; in readByte()
/libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/
DMessageDigest1Test.java59 final byte[] bytes = { 1, 2, 3, 4, 5 }; in test_updateLB$LILI()
60 md.update(bytes, 1, 2); in test_updateLB$LILI()
72 md.update(bytes, 0, bytes.length + 1); in test_updateLB$LILI()
78 md.update(bytes, Integer.MAX_VALUE, 1); in test_updateLB$LILI()
88 assertSame("buf", bytes, arg0); in test_updateLB$LILI()
94 md.update(bytes, offset, len); in test_updateLB$LILI()
153 final byte[] bytes = new byte[] { 2, 4, 1 }; in test_digestLB$LILI()
162 md.digest(bytes, 0, bytes.length + 1); in test_digestLB$LILI()
168 md.digest(bytes, Integer.MAX_VALUE, 1); in test_digestLB$LILI()
179 assertSame("buf", bytes, arg0); in test_digestLB$LILI()
[all …]
/libcore/luni/src/test/java/libcore/java/util/
DBitSetTest.java80 private static void assertBitSet(BitSet bs, byte[] bytes, String s) { in assertBitSet() argument
81 for (int i = 0; i < 8 * bytes.length; ++i) { in assertBitSet()
82 assertEquals(bs.toString(), ((bytes[i / 8] & (1L << (i % 8))) != 0), bs.get(i)); in assertBitSet()
85 for (int i = 0; i < bytes.length; ++i) { in assertBitSet()
86 cardinality += Integer.bitCount(((int) bytes[i]) & 0xff); in assertBitSet()
94 assertEquals(roundUp(8 * bytes.length, 64), bs.size()); in assertBitSet()
102 private static void assertBitSet(byte[] bytes, String s) { in assertBitSet() argument
104 assertBitSet(BitSet.valueOf(bytes), bytes, s); in assertBitSet() local
106 assertBitSet(BitSet.valueOf(ByteBuffer.wrap(bytes)), bytes, s); in assertBitSet() local
108 byte[] paddedBytes = new byte[1 + bytes.length + 1]; in assertBitSet()
[all …]
/libcore/harmony-tests/src/test/java/org/apache/harmony/tests/java/nio/
DByteBufferTest.java771 byte bytes[] = new byte[2]; in testAsCharBuffer()
780 buf.get(bytes); in testAsCharBuffer()
782 assertEquals(bytes2char(bytes, buf.order()), value); in testAsCharBuffer()
791 buf.get(bytes); in testAsCharBuffer()
793 assertEquals(bytes2char(bytes, buf.order()), value); in testAsCharBuffer()
805 buf.get(bytes); in testAsCharBuffer()
806 assertTrue(Arrays.equals(bytes, char2bytes(value, buf.order()))); in testAsCharBuffer()
817 buf.get(bytes); in testAsCharBuffer()
818 assertTrue(Arrays.equals(bytes, char2bytes(value, buf.order()))); in testAsCharBuffer()
827 byte bytes[] = new byte[8]; in testAsDoubleBuffer()
[all …]
/libcore/benchmarks/src/benchmarks/regression/
DCharsetBenchmark.java44 byte[] bytes = makeBytes(makeString(length)); in time_new_String_BString()
46 new String(bytes, name); in time_new_String_BString()
51 byte[] bytes = makeBytes(makeString(length)); in time_new_String_BII()
53 new String(bytes, 0, bytes.length); in time_new_String_BII()
58 byte[] bytes = makeBytes(makeString(length)); in time_new_String_BIIString()
60 new String(bytes, 0, bytes.length, name); in time_new_String_BIIString()
DChecksumBenchmark.java27 byte[] bytes = new byte[10000]; in timeAdler_block()
30 adler.update(bytes); in timeAdler_block()
40 byte[] bytes = new byte[10000]; in timeCrc_block()
43 crc.update(bytes); in timeCrc_block()
/libcore/harmony-tests/src/test/java/org/apache/harmony/tests/java/nio/charset/
DCharsetEncoder2Test.java162 ByteBuffer bytes = ByteBuffer.allocate(4); in test_EncodeLjava_nio_CharBufferLjava_nio_ByteBufferB() local
166 CoderResult result = encoder.encode(char1, bytes, false); in test_EncodeLjava_nio_CharBufferLjava_nio_ByteBufferB()
169 assertEquals(4, bytes.remaining()); in test_EncodeLjava_nio_CharBufferLjava_nio_ByteBufferB()
171 result = encoder.encode(char2, bytes, true); in test_EncodeLjava_nio_CharBufferLjava_nio_ByteBufferB()
175 assertEquals(0, bytes.remaining()); in test_EncodeLjava_nio_CharBufferLjava_nio_ByteBufferB()
178 assertEquals(4, bytes.limit()); in test_EncodeLjava_nio_CharBufferLjava_nio_ByteBufferB()
179 assertEquals((byte) 0xf0, bytes.get(0)); in test_EncodeLjava_nio_CharBufferLjava_nio_ByteBufferB()
180 assertEquals((byte) 0x90, bytes.get(1)); in test_EncodeLjava_nio_CharBufferLjava_nio_ByteBufferB()
181 assertEquals((byte) 0x80, bytes.get(2)); in test_EncodeLjava_nio_CharBufferLjava_nio_ByteBufferB()
182 assertEquals((byte) 0x80, bytes.get(3)); in test_EncodeLjava_nio_CharBufferLjava_nio_ByteBufferB()
[all …]
/libcore/luni/src/test/java/libcore/java/lang/reflect/
DArrayTest.java24 private static byte[] bytes; field in ArrayTest
35 bytes = new byte[] { (byte) 0xff }; in setUp()
46 try { Array.getBoolean(bytes, 0); fail(); } catch (IllegalArgumentException expected) {} in testGetBoolean()
58 assertEquals(bytes[0], Array.getByte(bytes, 0)); in testGetByte()
70 try { Array.getChar(bytes, 0); fail(); } catch (IllegalArgumentException expected) {} in testGetChar()
82 assertEquals((double) bytes[0], Array.getDouble(bytes, 0)); in testGetDouble()
94 assertEquals((float) bytes[0], Array.getFloat(bytes, 0)); in testGetFloat()
106 assertEquals((int) bytes[0], Array.getInt(bytes, 0)); in testGetInt()
118 assertEquals((long) bytes[0], Array.getLong(bytes, 0)); in testGetLong()
130 assertEquals((int) bytes[0], Array.getShort(bytes, 0)); in testGetShort()
[all …]
/libcore/luni/src/main/java/java/net/
DURLConnection.java701 byte[] bytes = new byte[64]; in guessContentTypeFromStream()
702 int length = is.read(bytes); in guessContentTypeFromStream()
714 if ((bytes[0] == (byte) 0xFF) && (bytes[1] == (byte) 0xFE)) { in guessContentTypeFromStream()
719 if ((bytes[0] == (byte) 0xFE) && (bytes[1] == (byte) 0xFF)) { in guessContentTypeFromStream()
725 if ((bytes[0] == (byte) 0xEF) && (bytes[1] == (byte) 0xBB) in guessContentTypeFromStream()
726 && (bytes[2] == (byte) 0xBF)) { in guessContentTypeFromStream()
731 if ((bytes[0] == (byte) 0x00) && (bytes[1] == (byte) 0x00) in guessContentTypeFromStream()
732 && (bytes[2] == (byte) 0xFE) in guessContentTypeFromStream()
733 && (bytes[3] == (byte) 0xFF)) { in guessContentTypeFromStream()
738 if ((bytes[0] == (byte) 0xFF) && (bytes[1] == (byte) 0xFE) in guessContentTypeFromStream()
[all …]
/libcore/harmony-tests/src/test/java/org/apache/harmony/tests/java/io/
DBufferedInputStreamTest.java256 byte[] bytes = new byte[256]; in test_markI()
258 bytes[i] = (byte) i; in test_markI()
261 new ByteArrayInputStream(bytes), 12); in test_markI()
268 in = new BufferedInputStream(new ByteArrayInputStream(bytes), 12); in test_markI()
278 bytes = new byte[3]; in test_markI()
279 int result = buf.read(bytes); in test_markI()
281 assertEquals("Assert 0:", 0, bytes[0]); in test_markI()
282 assertEquals("Assert 1:", 1, bytes[1]); in test_markI()
283 assertEquals("Assert 2:", 2, bytes[2]); in test_markI()
289 bytes = new byte[4]; in test_markI()
[all …]
DFileOutputStreamTest.java34 private byte[] bytes; field in FileOutputStreamTest
39 bytes = new byte[10]; in setUp()
40 for (int i = 0; i < bytes.length; i++) { in setUp()
41 bytes[i] = (byte) i; in setUp()
287 fos.write(bytes); in test_getChannel()
300 fos.write(bytes); in test_getChannel_Append()
302 fos.write(bytes); in test_getChannel_Append()
304 fos.write(bytes); in test_getChannel_Append()
321 fos.write(bytes); in test_getChannel_UnAppend()
323 fos.write(bytes); in test_getChannel_UnAppend()
[all …]
/libcore/luni/src/main/java/libcore/io/
DIoUtils.java198 private byte[] bytes; field in IoUtils.FileReader
229 bytes = new byte[capacity]; in FileReader()
234 int capacity = bytes.length; in readFully()
236 while ((read = Libcore.os.read(fd, bytes, count, capacity - count)) != 0) { in readFully()
244 System.arraycopy(bytes, 0, newBytes, 0, capacity); in readFully()
245 bytes = newBytes; in readFully()
265 if (count == bytes.length) { in toByteArray()
266 return bytes; in toByteArray()
269 System.arraycopy(bytes, 0, result, 0, count); in toByteArray()
274 return new String(bytes, 0, count, cs); in toString()
/libcore/harmony-tests/src/test/java/org/apache/harmony/tests/java/util/zip/
DInflaterOutputStreamTest.java259 byte[] bytes = { 0, 1, 2, 3 }; in test_write_$BII_Illegal()
261 ios.write(bytes, 0, 4); in test_write_$BII_Illegal()
277 ios.write(bytes, 0, 4); in test_write_$BII_Illegal()
283 ios.write(bytes, -1, 4); in test_write_$BII_Illegal()
289 ios.write(bytes, -1, -4); in test_write_$BII_Illegal()
295 ios.write(bytes, 0, 400); in test_write_$BII_Illegal()
333 ios.write(bytes, -1, 4); in test_write_$BII_Illegal()
339 ios.write(bytes, 0, -4); in test_write_$BII_Illegal()
345 ios.write(bytes, 0, 100); in test_write_$BII_Illegal()
351 ios.write(bytes, -100, 100); in test_write_$BII_Illegal()
[all …]
/libcore/luni/src/main/java/org/apache/harmony/security/provider/crypto/
DSHA1PRNG_SecureRandomImpl.java192 private void updateSeed(byte[] bytes) { in updateSeed() argument
197 SHA1Impl.updateHash(seed, bytes, 0, bytes.length - 1); in updateSeed()
199 seedLength += bytes.length; in updateSeed()
281 protected synchronized void engineNextBytes(byte[] bytes) { in engineNextBytes() argument
290 if (bytes == null) { in engineNextBytes()
346 if (bytes.length == 0) { in engineNextBytes()
353 n = (HASHBYTES_TO_USE - nextBIndex) < (bytes.length - nextByteToReturn) ? HASHBYTES_TO_USE in engineNextBytes()
355 : bytes.length - nextByteToReturn; in engineNextBytes()
357 System.arraycopy(nextBytes, nextBIndex, bytes, nextByteToReturn, n); in engineNextBytes()
362 if (nextByteToReturn >= bytes.length) { in engineNextBytes()
[all …]
/libcore/luni/src/test/java/libcore/javax/crypto/
DCipherInputStreamTest.java113 byte[] bytes = readAll(in); in testDecrypt_NullInput_Discarded()
115 Arrays.toString(bytes)); in testDecrypt_NullInput_Discarded()
123 byte[] bytes = readAll(in); in testEncrypt()
124 assertEquals(Arrays.toString(aesCipherText), Arrays.toString(bytes)); in testEncrypt()
135 byte[] bytes = readAll(in); in testEncrypt_RC4()
136 assertEquals(Arrays.toString(rc4CipherText), Arrays.toString(bytes)); in testEncrypt_RC4()
146 byte[] bytes = readAll(in); in testDecrypt()
147 assertEquals(Arrays.toString(plainText.getBytes("UTF-8")), Arrays.toString(bytes)); in testDecrypt()
154 byte[] bytes = readAll(in); in testDecrypt_RC4()
155 assertEquals(Arrays.toString(plainText.getBytes("UTF-8")), Arrays.toString(bytes)); in testDecrypt_RC4()
/libcore/support/src/test/java/org/apache/harmony/security/tests/support/
DRandomImpl.java40 protected void engineNextBytes(byte[] bytes) { in engineNextBytes() argument
42 for (int i = 0; i < bytes.length; i++) { in engineNextBytes()
43 bytes[i] = (byte)(i + 0xF1); in engineNextBytes()

123456