Home
last modified time | relevance | path

Searched refs:buf (Results 1 – 25 of 35) 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/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()
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()
DFileChannelDataSource.java102 ByteBuffer buf = ByteBuffer.allocateDirect((int) Math.min(remaining, MAX_READ_CHUNK_SIZE)); in feed() local
105 int chunkSize = (int) Math.min(remaining, buf.capacity()); in feed()
107 buf.limit(chunkSize); in feed()
111 int read = mChannel.read(buf); in feed()
118 buf.flip(); in feed()
119 sink.consume(buf); in feed()
120 buf.clear(); in feed()
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/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.java187 ByteBuffer buf = zip.getByteBuffer(bufOffsetInFile, maxEocdSize); in findZipEndOfCentralDirectoryRecord() local
188 buf.order(ByteOrder.LITTLE_ENDIAN); in findZipEndOfCentralDirectoryRecord()
189 int eocdOffsetInBuf = findZipEndOfCentralDirectoryRecord(buf); in findZipEndOfCentralDirectoryRecord()
195 buf.position(eocdOffsetInBuf); in findZipEndOfCentralDirectoryRecord()
196 ByteBuffer eocd = buf.slice(); in findZipEndOfCentralDirectoryRecord()
352 byte[] buf = new byte[65536]; in deflate()
354 int chunkSize = deflater.deflate(buf); in deflate()
355 out.write(buf, 0, chunkSize); in deflate()
/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/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/security/fuzzing/orphans/libexif/
Dlibexif_fuzzer.cpp14 char buf[1024]; in mnote_dump() local
15 exif_mnote_data_get_value(mn, i, buf, sizeof(buf)); in mnote_dump()
21 char buf[1024]; in dump_value() local
22 exif_entry_get_value(entry, buf, sizeof(buf)); in dump_value()
42 unsigned char *buf; in LLVMFuzzerTestOneInput() local
44 exif_data_save_data(image, &buf, &sz); in LLVMFuzzerTestOneInput()
45 free(buf); in LLVMFuzzerTestOneInput()
/tools/asuite/atest-py2/test_runners/
Drobolectric_test_runner.py158 buf = ''
163 buf += data
165 if not reg.match(buf) or data == '':
172 for event in re.split(r'\n\n', buf):
185 buf = ''
/tools/asuite/atest/test_runners/
Drobolectric_test_runner.py167 buf = ''
174 buf += data
176 if not reg.match(buf) or data == '':
183 for event in re.split(r'\n\n', buf):
196 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/main/java/com/android/apksig/util/
DDataSink.java36 void consume(byte[] buf, int offset, int length) throws IOException; in consume() argument
45 void consume(ByteBuffer buf) throws IOException; in consume() argument
/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()
DByteBufferBerDataValueReader.java28 public ByteBufferBerDataValueReader(ByteBuffer buf) { in ByteBufferBerDataValueReader() argument
29 if (buf == null) { in ByteBufferBerDataValueReader()
32 mBuf = buf; in ByteBufferBerDataValueReader()
/tools/apksig/src/main/java/com/android/apksig/internal/apk/
DApkSigningBlockUtilsLite.java362 public static byte[] readLengthPrefixedByteArray(ByteBuffer buf) throws ApkFormatException { in readLengthPrefixedByteArray() argument
363 int len = buf.getInt(); in readLengthPrefixedByteArray()
366 } else if (len > buf.remaining()) { in readLengthPrefixedByteArray()
369 + ", available: " + buf.remaining()); in readLengthPrefixedByteArray()
372 buf.get(result); in readLengthPrefixedByteArray()

12