Home
last modified time | relevance | path

Searched refs:buf (Results 1 – 25 of 40) sorted by relevance

12

/tools/apksig/src/test/java/com/android/apksig/util/
DDataSourceTestBase.java204 ByteBuffer buf = ByteBuffer.allocate(5); in testCopyTo() local
205 buf.position(2); in testCopyTo()
206 buf.limit(3); in testCopyTo()
207 assertCopyToThrowsBufferOverflow(ds, 0, 2, buf); in testCopyTo()
208 buf.position(2); in testCopyTo()
209 buf.limit(3); in testCopyTo()
210 assertCopyToThrowsBufferOverflow(slice, 1, 2, buf); in testCopyTo()
213 buf = ByteBuffer.allocate(10); in testCopyTo()
214 buf.position(2); in testCopyTo()
215 assertCopyToEquals("bcd", ds, 1, 3, buf); in testCopyTo()
[all …]
DDataSourceFromByteBufferTest.java34 ByteBuffer buf = ByteBuffer.wrap("abcdefgh".getBytes(StandardCharsets.UTF_8)); in testChangesToBufferPosAndLimitNotVisible() local
35 buf.position(1); in testChangesToBufferPosAndLimitNotVisible()
36 buf.limit(4); in testChangesToBufferPosAndLimitNotVisible()
37 DataSource ds = DataSources.asDataSource(buf); in testChangesToBufferPosAndLimitNotVisible()
38 buf.position(2); in testChangesToBufferPosAndLimitNotVisible()
39 buf.limit(buf.capacity()); in testChangesToBufferPosAndLimitNotVisible()
/tools/apksig/src/main/java/com/android/apksig/internal/zip/
DCentralDirectoryRecord.java130 public static CentralDirectoryRecord getRecord(ByteBuffer buf) throws ZipFormatException { in getRecord() argument
131 ZipUtils.assertByteOrderLittleEndian(buf); in getRecord()
132 if (buf.remaining() < HEADER_SIZE_BYTES) { in getRecord()
135 + " bytes, available: " + buf.remaining() + " bytes", in getRecord()
138 int originalPosition = buf.position(); in getRecord()
139 int recordSignature = buf.getInt(); in getRecord()
145 buf.position(originalPosition + GP_FLAGS_OFFSET); in getRecord()
146 short gpFlags = buf.getShort(); in getRecord()
147 short compressionMethod = buf.getShort(); in getRecord()
148 int lastModificationTime = ZipUtils.getUnsignedInt16(buf); in getRecord()
[all …]
DLocalFileRecord.java477 public void consume(byte[] buf, int offset, int length) throws IOException { in consume() argument
479 mInflater.setInput(buf, offset, length); in consume()
499 public void consume(ByteBuffer buf) throws IOException { in consume() argument
501 if (buf.hasArray()) { in consume()
502 consume(buf.array(), buf.arrayOffset() + buf.position(), buf.remaining()); in consume()
503 buf.position(buf.limit()); in consume()
508 while (buf.hasRemaining()) { in consume()
509 int chunkSize = Math.min(buf.remaining(), mInputBuffer.length); in consume()
510 buf.get(mInputBuffer, 0, chunkSize); in consume()
DZipUtils.java181 ByteBuffer buf = zip.getByteBuffer(bufOffsetInFile, maxEocdSize); in findZipEndOfCentralDirectoryRecord() local
182 buf.order(ByteOrder.LITTLE_ENDIAN); in findZipEndOfCentralDirectoryRecord()
183 int eocdOffsetInBuf = findZipEndOfCentralDirectoryRecord(buf); in findZipEndOfCentralDirectoryRecord()
189 buf.position(eocdOffsetInBuf); in findZipEndOfCentralDirectoryRecord()
190 ByteBuffer eocd = buf.slice(); in findZipEndOfCentralDirectoryRecord()
306 byte[] buf = new byte[65536]; in deflate()
308 int chunkSize = deflater.deflate(buf); in deflate()
309 out.write(buf, 0, chunkSize); in deflate()
/tools/apksig/src/main/java/com/android/apksig/internal/util/
DOutputStreamDataSink.java52 public void consume(byte[] buf, int offset, int length) throws IOException { in consume() argument
53 mOut.write(buf, offset, length); in consume()
57 public void consume(ByteBuffer buf) throws IOException { in consume() argument
58 if (!buf.hasRemaining()) { in consume()
62 if (buf.hasArray()) { in consume()
64 buf.array(), in consume()
65 buf.arrayOffset() + buf.position(), in consume()
66 buf.remaining()); in consume()
67 buf.position(buf.limit()); in consume()
69 byte[] tmp = new byte[Math.min(buf.remaining(), MAX_READ_CHUNK_SIZE)]; in consume()
[all …]
DByteArrayDataSink.java49 public void consume(byte[] buf, int offset, int length) throws IOException { in consume() argument
55 if (offset > buf.length) { in consume()
59 "offset: " + offset + ", buf.length: " + buf.length); in consume()
66 System.arraycopy(buf, offset, mArray, mSize, length); in consume()
71 public void consume(ByteBuffer buf) throws IOException { in consume() argument
72 if (!buf.hasRemaining()) { in consume()
76 if (buf.hasArray()) { in consume()
77 consume(buf.array(), buf.arrayOffset() + buf.position(), buf.remaining()); in consume()
78 buf.position(buf.limit()); in consume()
82 ensureAvailable(buf.remaining()); in consume()
[all …]
DRandomAccessFileDataSink.java66 public void consume(byte[] buf, int offset, int length) throws IOException { in consume() argument
72 if (offset > buf.length) { in consume()
76 "offset: " + offset + ", buf.length: " + buf.length); in consume()
84 mFile.write(buf, offset, length); in consume()
90 public void consume(ByteBuffer buf) throws IOException { in consume() argument
91 int length = buf.remaining(); in consume()
98 while (buf.hasRemaining()) { in consume()
99 mFileChannel.write(buf); in consume()
DMessageDigestSink.java35 public void consume(byte[] buf, int offset, int length) { in consume() argument
37 md.update(buf, offset, length); in consume()
42 public void consume(ByteBuffer buf) { in consume() argument
43 int originalPosition = buf.position(); in consume()
47 buf.position(originalPosition); in consume()
48 md.update(buf); in consume()
DTeeDataSink.java35 public void consume(byte[] buf, int offset, int length) throws IOException { in consume() argument
37 sink.consume(buf, offset, length); in consume()
42 public void consume(ByteBuffer buf) throws IOException { in consume() argument
43 int originalPosition = buf.position(); in consume()
46 buf.position(originalPosition); in consume()
48 mSinks[i].consume(buf); in consume()
DRandomAccessFileDataSource.java106 ByteBuffer buf = ByteBuffer.allocateDirect((int) Math.min(remaining, MAX_READ_CHUNK_SIZE)); in feed() local
109 int chunkSize = (int) Math.min(remaining, buf.capacity()); in feed()
111 buf.limit(chunkSize); in feed()
115 int read = mChannel.read(buf); in feed()
122 buf.flip(); in feed()
123 sink.consume(buf); in feed()
124 buf.clear(); in feed()
DByteBufferSink.java40 public void consume(byte[] buf, int offset, int length) throws IOException { in consume() argument
42 mBuffer.put(buf, offset, length); in consume()
50 public void consume(ByteBuffer buf) throws IOException { in consume() argument
51 int length = buf.remaining(); in consume()
53 mBuffer.put(buf); in consume()
DByteBufferUtils.java28 public static byte[] toByteArray(ByteBuffer buf) { in toByteArray() argument
29 byte[] result = new byte[buf.remaining()]; in toByteArray()
30 buf.get(result); in toByteArray()
DByteStreams.java34 byte[] buf = new byte[16384]; in toByteArray()
36 while ((chunkSize = in.read(buf)) != -1) { in toByteArray()
37 result.write(buf, 0, chunkSize); in toByteArray()
/tools/apksig/src/test/java/com/android/apksig/internal/util/
DByteBufferSinkTestBase.java31 ByteBuffer buf = createBuffer(1024); in createDataSink() local
34 buf.position(START_POS); in createDataSink()
35 buf.limit(buf.capacity() - 300); in createDataSink()
36 return CloseableWithDataSink.of(new ByteBufferSink(buf)); in createDataSink()
41 ByteBuffer buf = dataSink.getBuffer(); in getContents() local
42 int oldPos = buf.position(); in getContents()
43 int oldLimit = buf.limit(); in getContents()
45 buf.position(START_POS); in getContents()
46 buf.limit(oldPos); in getContents()
47 return buf.slice(); in getContents()
[all …]
DHexEncoding.java54 public static String encode(ByteBuffer buf) { in encode() argument
55 return encode(buf.array(), buf.arrayOffset() + buf.position(), buf.remaining()); in encode()
/tools/tradefederation/core/tests/src/com/android/tradefed/command/remote/
DRemoteManagerTest.java74 String buf = "test\n"; in testProcessClientOperations_invalidAction() local
75 InputStream data = new ByteArrayInputStream(buf.getBytes()); in testProcessClientOperations_invalidAction()
93 String buf = "{version=\"8\", type=\"START_HANDOVER\", port=\"5555\"}"; in testProcessClientOperations_initHandover() local
94 InputStream data = new ByteArrayInputStream(buf.getBytes()); in testProcessClientOperations_initHandover()
112 String buf = "{version=\"8\", type=\"ADD_COMMAND\", time=\"5\", commandArgs=[\"empty\"]}"; in testProcessClientOperations_addCommand() local
113 InputStream data = new ByteArrayInputStream(buf.getBytes()); in testProcessClientOperations_addCommand()
128 String buf = "{version=\"8\", type=\"ADD_COMMAND\", time=\"5\", commandArgs=[\"empty\"]}"; in testProcessClientOperations_addCommand_fail() local
129 InputStream data = new ByteArrayInputStream(buf.getBytes()); in testProcessClientOperations_addCommand_fail()
146 String buf = "{version=\"8\", type=\"ADD_COMMAND\", time=\"5\", commandArgs=[\"empty\"]}"; in testProcessClientOperations_addCommand_config() local
147 InputStream data = new ByteArrayInputStream(buf.getBytes()); in testProcessClientOperations_addCommand_config()
[all …]
/tools/test/graphicsbenchmark/apps/sample_app/src/cpp/
Dshader.cpp40 char* buf = (char*) malloc(infoLen); in loadShader() local
41 if (buf) { in loadShader()
42 glGetShaderInfoLog(shader, infoLen, NULL, buf); in loadShader()
44 shaderType, buf); in loadShader()
45 free(buf); in loadShader()
81 char* buf = (char*) malloc(bufLength); in createProgram() local
82 if (buf) { in createProgram()
83 glGetProgramInfoLog(program, bufLength, NULL, buf); in createProgram()
84 LOGE("Could not link program:\n%s\n", buf); in createProgram()
85 free(buf); in createProgram()
/tools/metalava/src/main/java/com/android/tools/metalava/model/
DFieldItem.kt285 val buf = StringBuilder(str.length) in javaUnescapeString() constant
301 buf.append(c) in javaUnescapeString()
305 buf.append('\\') in javaUnescapeString()
309 buf.append('\t') in javaUnescapeString()
313 buf.append('\b') in javaUnescapeString()
317 buf.append('\r') in javaUnescapeString()
321 buf.append('\n') in javaUnescapeString()
325 buf.append('\'') in javaUnescapeString()
329 buf.append('\"') in javaUnescapeString()
350 buf.append(escaped) in javaUnescapeString()
[all …]
/tools/tradefederation/core/src/com/android/tradefed/util/
DStreamUtil.java179 byte[] buf = new byte[BUF_SIZE]; in copyStreams()
181 while ((size = inStream.read(buf)) != -1) { in copyStreams()
182 outStream.write(buf, 0, size); in copyStreams()
196 byte[] buf = new byte[BUF_SIZE]; in copyStreamToWriter()
198 while ((size = inStream.read(buf)) != -1) { in copyStreamToWriter()
199 writer.write(new String(buf, 0, size)); in copyStreamToWriter()
349 byte[] buf = new byte[BUF_SIZE]; in calculateMd5Digest()
350 while (input.read(buf) != -1) { in calculateMd5Digest()
/tools/tradefederation/core/atest/test_runners/
Drobolectric_test_runner.py158 buf = ''
161 buf += data
163 if not reg.match(buf) or data == '':
170 for event in re.split(r'\n\n', buf):
183 buf = ''
/tools/apkzlib/src/main/java/com/android/tools/build/apkzlib/sign/
DZFileDataSource.java110 byte[] buf = new byte[(int) Math.min(remaining, MAX_READ_CHUNK_SIZE)]; in feed()
112 int chunkSize = (int) Math.min(remaining, buf.length); in feed()
113 int readSize = file.directRead(chunkOffsetInFile, buf, 0, chunkSize); in feed()
118 sink.consume(buf, 0, readSize); in feed()
/tools/apksig/src/test/java/com/android/apksig/internal/asn1/
DAsn1BerParserTest.java58 HexEncoding.encode(parse("30050403123456", SequenceWithOctetString.class).buf)); in testOctetString()
60 "", HexEncoding.encode(parse("30020400", SequenceWithOctetString.class).buf)); in testOctetString()
67 HexEncoding.encode(parse("30050303123456", SequenceWithBitString.class).buf)); in testBitString()
69 "", HexEncoding.encode(parse("30020300", SequenceWithBitString.class).buf)); in testBitString()
402 public ByteBuffer buf; field in Asn1BerParserTest.SequenceWithOctetString
408 public ByteBuffer buf; field in Asn1BerParserTest.SequenceWithBitString
/tools/apksig/src/main/java/com/android/apksig/internal/asn1/ber/
DInputStreamBerDataValueReader.java282 byte[] buf = new byte[4096]; in skip()
283 int len = mIn.read(buf, 0, (int) Math.min(buf.length, n)); in skip()
285 mBuf.write(buf, 0, len); in skip()
/tools/apksig/src/main/java/com/android/apksig/internal/asn1/
DAsn1DerEncoder.java506 ByteBuffer buf = ((Asn1OpaqueObject) source).getEncoded(); in toDer() local
507 byte[] result = new byte[buf.remaining()]; in toDer()
508 buf.get(result); in toDer()
521 ByteBuffer buf = (ByteBuffer) source; in toDer() local
522 value = new byte[buf.remaining()]; in toDer()
523 buf.slice().get(value); in toDer()

12