Home
last modified time | relevance | path

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

12345678

/libcore/ojluni/src/main/native/
DObjectInputStream.c61 jbyte *bytes; in Java_java_io_ObjectInputStream_bytesToFloats() local
73 bytes = (*env)->GetPrimitiveArrayCritical(env, src, NULL); in Java_java_io_ObjectInputStream_bytesToFloats()
74 if (bytes == NULL) /* exception thrown */ in Java_java_io_ObjectInputStream_bytesToFloats()
79 (*env)->ReleasePrimitiveArrayCritical(env, src, bytes, JNI_ABORT); in Java_java_io_ObjectInputStream_bytesToFloats()
85 (*env)->ReleasePrimitiveArrayCritical(env, src, bytes, JNI_ABORT); in Java_java_io_ObjectInputStream_bytesToFloats()
92 ival = ((bytes[srcpos + 0] & 0xFF) << 24) + in Java_java_io_ObjectInputStream_bytesToFloats()
93 ((bytes[srcpos + 1] & 0xFF) << 16) + in Java_java_io_ObjectInputStream_bytesToFloats()
94 ((bytes[srcpos + 2] & 0xFF) << 8) + in Java_java_io_ObjectInputStream_bytesToFloats()
95 ((bytes[srcpos + 3] & 0xFF) << 0); in Java_java_io_ObjectInputStream_bytesToFloats()
101 (*env)->ReleasePrimitiveArrayCritical(env, src, bytes, JNI_ABORT); in Java_java_io_ObjectInputStream_bytesToFloats()
[all …]
DObjectOutputStream.c60 jbyte *bytes; in Java_java_io_ObjectOutputStream_floatsToBytes() local
83 bytes = (*env)->GetPrimitiveArrayCritical(env, dst, NULL); in Java_java_io_ObjectOutputStream_floatsToBytes()
84 if (bytes == NULL) { /* exception thrown */ in Java_java_io_ObjectOutputStream_floatsToBytes()
99 bytes[dstpos++] = (ival >> 24) & 0xFF; in Java_java_io_ObjectOutputStream_floatsToBytes()
100 bytes[dstpos++] = (ival >> 16) & 0xFF; in Java_java_io_ObjectOutputStream_floatsToBytes()
101 bytes[dstpos++] = (ival >> 8) & 0xFF; in Java_java_io_ObjectOutputStream_floatsToBytes()
102 bytes[dstpos++] = (ival >> 0) & 0xFF; in Java_java_io_ObjectOutputStream_floatsToBytes()
106 (*env)->ReleasePrimitiveArrayCritical(env, dst, bytes, 0); in Java_java_io_ObjectOutputStream_floatsToBytes()
132 jbyte *bytes; in Java_java_io_ObjectOutputStream_doublesToBytes() local
155 bytes = (*env)->GetPrimitiveArrayCritical(env, dst, NULL); in Java_java_io_ObjectOutputStream_doublesToBytes()
[all …]
DLinuxNativeDispatcher.c181 jbyteArray bytes; in Java_sun_nio_fs_LinuxNativeDispatcher_getmntent() local
196 bytes = (*env)->NewByteArray(env, len); in Java_sun_nio_fs_LinuxNativeDispatcher_getmntent()
197 if (bytes == NULL) in Java_sun_nio_fs_LinuxNativeDispatcher_getmntent()
199 (*env)->SetByteArrayRegion(env, bytes, 0, len, (jbyte*)name); in Java_sun_nio_fs_LinuxNativeDispatcher_getmntent()
200 (*env)->SetObjectField(env, entry, entry_name, bytes); in Java_sun_nio_fs_LinuxNativeDispatcher_getmntent()
203 bytes = (*env)->NewByteArray(env, len); in Java_sun_nio_fs_LinuxNativeDispatcher_getmntent()
204 if (bytes == NULL) in Java_sun_nio_fs_LinuxNativeDispatcher_getmntent()
206 (*env)->SetByteArrayRegion(env, bytes, 0, len, (jbyte*)dir); in Java_sun_nio_fs_LinuxNativeDispatcher_getmntent()
207 (*env)->SetObjectField(env, entry, entry_dir, bytes); in Java_sun_nio_fs_LinuxNativeDispatcher_getmntent()
210 bytes = (*env)->NewByteArray(env, len); in Java_sun_nio_fs_LinuxNativeDispatcher_getmntent()
[all …]
/libcore/ojluni/src/main/java/sun/security/util/
DManifestDigester.java110 public ManifestDigester(byte bytes[]) in ManifestDigester() argument
112 rawBytes = bytes; in ManifestDigester()
133 if (isNameAttr(bytes, start)) { in ManifestDigester()
138 new String(bytes, start+6, len-6, "UTF8")); in ManifestDigester()
142 if (bytes[i] == '\r') { in ManifestDigester()
150 if (bytes[i++] == ' ') { in ManifestDigester()
154 && (bytes[i++] != '\n')); in ManifestDigester()
155 if (bytes[i-1] != '\n') in ManifestDigester()
158 if (bytes[i-2] == '\r') in ManifestDigester()
163 nameBuf.append(new String(bytes, wrapStart, in ManifestDigester()
[all …]
DDerOutputStream.java189 byte[] bytes = new byte[4]; in putIntegerContents()
194 bytes[3] = (byte) (i & 0xff); in putIntegerContents()
195 bytes[2] = (byte)((i & 0xff00) >>> 8); in putIntegerContents()
196 bytes[1] = (byte)((i & 0xff0000) >>> 16); in putIntegerContents()
197 bytes[0] = (byte)((i & 0xff000000) >>> 24); in putIntegerContents()
202 if (bytes[0] == (byte)0xff) { in putIntegerContents()
207 if ((bytes[j] == (byte)0xff) && in putIntegerContents()
208 ((bytes[j+1] & 0x80) == 0x80)) in putIntegerContents()
213 } else if (bytes[0] == 0x00) { in putIntegerContents()
218 if ((bytes[j] == 0x00) && in putIntegerContents()
[all …]
/libcore/luni/src/test/java/libcore/libcore/io/
DMemoryMappedFileTest.java55 byte[] bytes = new byte[0]; in testMmapRo_emptyFile()
56 File file = createFile(bytes); in testMmapRo_emptyFile()
68 byte[] bytes = createBytes(10); in testMmapRo()
69 File file = createFile(bytes); in testMmapRo()
78 byte[] bytes = createBytes(10); in testMmapRo_close()
79 File file = createFile(bytes); in testMmapRo_close()
100 byte[] bytes = createBytes(10); in testReadAfterCloseFails()
101 File file = createFile(bytes); in testReadAfterCloseFails()
120 byte[] bytes = createBytes(10); in checkReadByte()
121 File file = createFile(bytes); in checkReadByte()
[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.java28 private ByteArrayOutputStream bytes = new ByteArrayOutputStream(); field in DataOutputStreamTest
29 private DataOutputStream os = new DataOutputStream(bytes);
34 assertEquals("0100", HexEncoding.encodeToString(bytes.toByteArray())); in test_writeBoolean()
44 assertEquals("FF00018134", HexEncoding.encodeToString(bytes.toByteArray())); in test_writeByte()
50 assertEquals("303431", HexEncoding.encodeToString(bytes.toByteArray())); in test_writeBytes()
57 assertEquals("00301234", HexEncoding.encodeToString(bytes.toByteArray())); in test_writeChar()
63 assertEquals("003012340031", HexEncoding.encodeToString(bytes.toByteArray())); in test_writeChars()
68 assertEquals("0123456789ABCDEF", HexEncoding.encodeToString(bytes.toByteArray())); in test_writeDouble()
73 assertEquals("01234567", HexEncoding.encodeToString(bytes.toByteArray())); in test_writeFloat()
78 assertEquals("01234567", HexEncoding.encodeToString(bytes.toByteArray())); in test_writeInt()
[all …]
/libcore/luni/src/test/java/libcore/java/util/
DBitSetTest.java97 private static void assertBitSet(BitSet bs, byte[] bytes, String s) { in assertBitSet() argument
98 for (int i = 0; i < 8 * bytes.length; ++i) { in assertBitSet()
99 assertEquals(bs.toString(), ((bytes[i / 8] & (1L << (i % 8))) != 0), bs.get(i)); in assertBitSet()
102 for (int i = 0; i < bytes.length; ++i) { in assertBitSet()
103 cardinality += Integer.bitCount(((int) bytes[i]) & 0xff); in assertBitSet()
111 assertEquals(roundUp(8 * bytes.length, 64), bs.size()); in assertBitSet()
119 private static void assertBitSet(byte[] bytes, String s) { in assertBitSet() argument
121 assertBitSet(BitSet.valueOf(bytes), bytes, s); in assertBitSet() local
123 assertBitSet(BitSet.valueOf(ByteBuffer.wrap(bytes)), bytes, s); in assertBitSet() local
125 byte[] paddedBytes = new byte[1 + bytes.length + 1]; in assertBitSet()
[all …]
DLibcoreIoDerivedBase64Test.java214 byte[] bytes = asciiToBytes(in); in decodeToString()
215 byte[] out = decode(bytes); in decodeToString()
222 private static String bytesToAscii(byte[] bytes) { in bytesToAscii() argument
227 ByteBuffer bytesBuffer = ByteBuffer.wrap(bytes); in bytesToAscii()
235 Arrays.toString(bytesToInts(bytes)) + " contains non-ASCII codes"); in bytesToAscii()
248 byte[] bytes = new byte[bytesBuffer.remaining()]; in asciiToBytes()
249 bytesBuffer.get(bytes, 0, bytes.length); in asciiToBytes()
250 return bytes; in asciiToBytes()
260 byte[] bytes = decode(asciiToBytes(in)); in decodeToInts()
261 return bytesToInts(bytes); in decodeToInts()
[all …]
/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/benchmarks/src/benchmarks/regression/
DCharsetBenchmark.java42 byte[] bytes = makeBytes(makeString(length)); in time_new_String_BString()
44 new String(bytes, name); in time_new_String_BString()
49 byte[] bytes = makeBytes(makeString(length)); in time_new_String_BII()
51 new String(bytes, 0, bytes.length); in time_new_String_BII()
56 byte[] bytes = makeBytes(makeString(length)); in time_new_String_BIIString()
58 new String(bytes, 0, bytes.length, name); in time_new_String_BIIString()
DChecksumBenchmark.java24 byte[] bytes = new byte[10000]; in timeAdler_block()
27 adler.update(bytes); in timeAdler_block()
37 byte[] bytes = new byte[10000]; in timeCrc_block()
40 crc.update(bytes); in timeCrc_block()
/libcore/harmony-tests/src/test/java/org/apache/harmony/tests/java/nio/
DByteBufferTest.java846 byte bytes[] = new byte[2]; in testAsCharBuffer()
855 buf.get(bytes); in testAsCharBuffer()
857 assertEquals(bytes2char(bytes, buf.order()), value); in testAsCharBuffer()
866 buf.get(bytes); in testAsCharBuffer()
868 assertEquals(bytes2char(bytes, buf.order()), value); in testAsCharBuffer()
880 buf.get(bytes); in testAsCharBuffer()
881 assertTrue(Arrays.equals(bytes, char2bytes(value, buf.order()))); in testAsCharBuffer()
892 buf.get(bytes); in testAsCharBuffer()
893 assertTrue(Arrays.equals(bytes, char2bytes(value, buf.order()))); in testAsCharBuffer()
902 byte bytes[] = new byte[8]; in testAsDoubleBuffer()
[all …]
/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/ojluni/src/main/java/sun/net/
DTelnetInputStream.java128 public int read(byte bytes[]) throws IOException { in read() argument
129 return read(bytes, 0, bytes.length); in read()
136 public int read(byte bytes[], int off, int length) throws IOException { in read() argument
138 return super.read(bytes, off, length); in read()
147 bytes[off++] = (byte)c; in read()
/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/ojluni/src/test/java/time/tck/java/time/serial/
DTCKLocalTimeSerialization.java101 byte[] bytes = baos.toByteArray(); in test_serialization_format_h()
102 assertSerializedBySer(LocalTime.of(22, 0), bytes); in test_serialization_format_h()
113 byte[] bytes = baos.toByteArray(); in test_serialization_format_hm()
114 assertSerializedBySer(LocalTime.of(22, 17), bytes); in test_serialization_format_hm()
126 byte[] bytes = baos.toByteArray(); in test_serialization_format_hms()
127 assertSerializedBySer(LocalTime.of(22, 17, 59), bytes); in test_serialization_format_hms()
140 byte[] bytes = baos.toByteArray(); in test_serialization_format_hmsn()
141 assertSerializedBySer(LocalTime.of(22, 17, 59, 459_000_000), bytes); in test_serialization_format_hmsn()
DTCKZoneOffsetSerialization.java90 byte[] bytes = baos.toByteArray(); in test_serialization_format_quarterPositive()
91 assertSerializedBySer(ZoneOffset.ofHoursMinutes(1, 30), bytes); in test_serialization_format_quarterPositive()
101 byte[] bytes = baos.toByteArray(); in test_serialization_format_quarterNegative()
102 assertSerializedBySer(ZoneOffset.ofHoursMinutes(-2, -30), bytes); in test_serialization_format_quarterNegative()
113 byte[] bytes = baos.toByteArray(); in test_serialization_format_full()
114 assertSerializedBySer(ZoneOffset.ofTotalSeconds(53265), bytes); in test_serialization_format_full()
/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 …]
/libcore/ojluni/src/test/java/time/tck/java/time/
DAbstractTCKTest.java122 byte[] bytes = baos.toByteArray(); in assertSerializedBySer()
123 ByteArrayInputStream bais = new ByteArrayInputStream(bytes); in assertSerializedBySer()
192 byte[] bytes = baos.toByteArray(); in assertNotSerializable()
194 try (ByteArrayInputStream bis = new ByteArrayInputStream(bytes); in assertNotSerializable()
210 protected static String dumpSerialStream(byte[] bytes) { in dumpSerialStream() argument
211 StringBuilder sb = new StringBuilder(bytes.length * 5); in dumpSerialStream()
215 for (int i = 0; i < bytes.length; i++) { in dumpSerialStream()
219 fmt.format(" %3d,", bytes[i] & 0xff); in dumpSerialStream()
220 if ((i % linelen) == (linelen-1) || i == bytes.length - 1) { in dumpSerialStream()
224 for (int j = 0; j <= k && s + j < bytes.length; j++) { in dumpSerialStream()
[all …]
/libcore/ojluni/src/main/java/sun/security/x509/
DUniqueIdentity.java98 byte[] bytes = id.toByteArray(); in encode()
99 int excessBits = bytes.length*8 - id.length(); in encode()
102 out.putLength(bytes.length + 1); in encode()
105 out.write(bytes); in encode()
/libcore/ojluni/src/main/java/java/net/
DURLDecoder.java146 byte[] bytes = null; in decode()
169 if (bytes == null) in decode()
170 bytes = new byte[(numChars-i)/3]; in decode()
186 bytes[pos++] = (byte) v; in decode()
199 sb.append(new String(bytes, 0, pos, enc)); in decode()
/libcore/luni/src/test/java/libcore/java/lang/
DStringTest.java103 byte[] bytes = "xa\u0666bx".getBytes("UTF-8"); in testString_BII()
104 assertEquals("a\u0666b", new String(bytes, 1, bytes.length - 2)); in testString_BII()
108 byte[] bytes = "xa\u0666bx".getBytes("UTF-8"); in testString_BIIString()
109 assertEquals("a\u0666b", new String(bytes, 1, bytes.length - 2, "UTF-8")); in testString_BIIString()
113 byte[] bytes = "xa\u0666bx".getBytes("UTF-8"); in testString_BIICharset()
114 assertEquals("a\u0666b", new String(bytes, 1, bytes.length - 2, Charset.forName("UTF-8"))); in testString_BIICharset()
118 byte[] bytes = "a\u0666b".getBytes("UTF-8"); in testString_BCharset()
119 assertEquals("a\u0666b", new String(bytes, Charset.forName("UTF-8"))); in testString_BCharset()
124 byte[] bytes = new byte[] {(byte) 'h', (byte) 'i'}; in testStringFromCharset_MaliciousCharset()
125 final String result = new String(bytes, cs); in testStringFromCharset_MaliciousCharset()
[all …]
/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()

12345678