If no progress listener has been set, return the byte sink defined in constructor, otherwise decorate it.

@return the byte sink to be used for download operations.
558953
public ByteSink getByteSink()
    {
        ByteSink bs = byteSink;
        if ( progressListener != null ) {
            bs = new ProgressByteSink( bs, progressListener );
        }
        return bs;
    }
1093923
public final Mono<ByteBuffer> asByteBuffer() {
		return handle((bb, sink) -> {
			try {
				sink.next(bb.nioBuffer());
			}
			catch (IllegalReferenceCountException e) {
				sink.complete();
			}
		});
	}
239261
public byte[] getBytes() {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "getBytes");

    byte[] b = designation.toByteArray();
    byte[] c = new byte[b.length+1];

    c[0] = Cellule.MESSAGINGENGINE;
    for (int i=0; i < b.length; i++) {
      c[i+1] = b[i];
    }

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getBytes", c);
    return c;
  }
249545
@Nonnull
  public ByteBuffer getByteBuffer() {
    if (base instanceof byte[] && offset >= BYTE_ARRAY_OFFSET) {
      final byte[] bytes = (byte[]) base;

      // the offset includes an object header... this is only needed for unsafe copies
      final long arrayOffset = offset - BYTE_ARRAY_OFFSET;

      // verify that the offset and length points somewhere inside the byte array
      // and that the offset can safely be truncated to a 32-bit integer
      if ((long) bytes.length < arrayOffset + numBytes) {
        throw new ArrayIndexOutOfBoundsException();
      }

      return ByteBuffer.wrap(bytes, (int) arrayOffset, numBytes);
    } else {
      return ByteBuffer.wrap(getBytes());
    }
  }
296599
public InputStream getBody(ProgressListener listener) {
        if (this.inputStream == null) {
            String contentEncoding = this.connection.getContentEncoding();
            try {
                if (this.rawInputStream == null) {
                    this.rawInputStream = this.connection.getInputStream();
                }

                if (listener == null) {
                    this.inputStream = this.rawInputStream;
                } else {
                    this.inputStream = new ProgressInputStream(this.rawInputStream, listener,
                        this.getContentLength());
                }

                if (contentEncoding != null && contentEncoding.equalsIgnoreCase("gzip")) {
                    this.inputStream = new GZIPInputStream(this.inputStream);
                }
            } catch (IOException e) {
                throw new BoxAPIException("Couldn't connect to the Box API due to a network error.", e);
            }
        }

        return this.inputStream;
    }
23476
public Sink reloadAsync() throws ExecutionException, InterruptedException {
    // [START reloadAsync]
    Future<Sink> future = sink.reloadAsync();
    // ...
    Sink latestSink = future.get();
    if (latestSink == null) {
      // the sink was not found
    }
    // [END reloadAsync]
    return latestSink;
  }
382299
public byte[] getBytes() {
    // avoid copy if `base` is `byte[]`
    if (offset == BYTE_ARRAY_OFFSET && base instanceof byte[]
      && ((byte[]) base).length == numBytes) {
      return (byte[]) base;
    } else {
      byte[] bytes = new byte[numBytes];
      copyMemory(base, offset, bytes, BYTE_ARRAY_OFFSET, numBytes);
      return bytes;
    }
  }
1217947
public static void downloadDataToSink( CResponse response, ByteSink byteSink )
    {
        InputStream is = null;
        ByteSinkStream bss = null;
        boolean success = false;
        try {

            long contentLength = response.getContentLength();
            if ( contentLength >= 0 ) {
                // content length is known: inform any listener
                byteSink.setExpectedLength( contentLength );
            }

            long current = 0;
            is = response.openStream();
            bss = byteSink.openStream();

            byte[] buffer = new byte[ 8 * 1024 ];
            int len;
            while ( ( len = is.read( buffer ) ) != -1 ) {
                current += len;
                bss.write( buffer, 0, len );
            }

            if ( contentLength < 0 ) {
                // content length was unknown; inform listener operation is terminated
                byteSink.setExpectedLength( current );
            }

            bss.flush();
            bss.close();
            bss = null;

            success = true;

        } catch ( IOException ex ) {
            throw new CStorageException( ex.getMessage(), ex );
        } finally {
            if ( bss != null && !success ) {
                bss.abort();
            }

            PcsUtils.closeQuietly( is );
            PcsUtils.closeQuietly( bss );
        }
    }
312170
static ProgressMonitor getMonitor() {
        return new ProgressMonitor() {

            @Override
            public void message(String msg) {
                System.out.println(msg + "...");
            }

            @Override
            public void progress(int prog) {
                if ("\\".equals(System.getProperty("file.separator"))) {
                    System.out.print("\b\b\b\b\b\b\b\b\b");
                }
                else {
                    System.out.print("\r         \r");
                }
                if (prog >= 100)
                    System.out.println(" --> Done");
                else if (prog <= 0) // don't report zero progress since it may indicate unknown
                    System.out.print(" ... ");
                else
                    System.out.printf(" --> %3d%%", prog);
            }

        };
    }
1170775
public byte[] getBytes() {
		final int len = getVInt();
		final byte[] bytes = new byte[len];
		System.arraycopy(buf, bufPosition, bytes, 0, bytes.length);
		bufPosition += bytes.length;
		return bytes;
	}
244068
private synchronized Producer<CloseableReference<CloseableImage>> getNetworkFetchSequence() {
    if (FrescoSystrace.isTracing()) {
      FrescoSystrace.beginSection("ProducerSequenceFactory#getNetworkFetchSequence");
    }
    if (mNetworkFetchSequence == null) {
      if (FrescoSystrace.isTracing()) {
        FrescoSystrace.beginSection("ProducerSequenceFactory#getNetworkFetchSequence:init");
      }
      mNetworkFetchSequence =
          newBitmapCacheGetToDecodeSequence(getCommonNetworkFetchToEncodedMemorySequence());
      if (FrescoSystrace.isTracing()) {
        FrescoSystrace.endSection();
      }
    }
    if (FrescoSystrace.isTracing()) {
      FrescoSystrace.endSection();
    }
    return mNetworkFetchSequence;
  }
106299
public int download() {
		try {
			//if (url.startsWith("https://packagist.org") || url.startsWith("https://getcomposer.org")) {
			if (url.startsWith("https://")) {
				registerSSLContext(client.getBackend());
			}
			
			final HttpGet httpGet = new HttpGet(url);
			
			
			if (httpGet.isAborted()) {
				httpGet.abort();
			}
			
			client.execute(httpGet, new FutureCallback<HttpResponse>() {
				
				@Override
				public void failed(Exception e) {
					for (DownloadListenerInterface listener : listeners) {
						listener.errorOccured(e);
					}
				}

				@Override
				public void completed(HttpResponse response) {
					for (DownloadListenerInterface listener : listeners) {
						try {
							listener.dataReceived(response.getEntity().getContent(), httpGet.getURI().toString());
						} catch (Exception e) {
							listener.errorOccured(e);
						}
					}
				}

				@Override
				public void cancelled() {
					for (DownloadListenerInterface listener : listeners) {
						listener.aborted(httpGet.getURI().toString());
					}
				}
			});
			
			httpGets.add(httpGet);
//			client.shutdown();
			
			lastSlot = httpGets.size() - 1;
						
			return lastSlot;
			
		} catch (Exception e) {
			for (DownloadListenerInterface listener : listeners) {
				listener.errorOccured(e);
			}
		}
		
		return -1;
	}
476110
private synchronized Producer<Void> getLocalFileFetchToEncodedMemoryPrefetchSequence() {
    if (FrescoSystrace.isTracing()) {
      FrescoSystrace.beginSection(
          "ProducerSequenceFactory#getLocalFileFetchToEncodedMemoryPrefetchSequence");
    }
    if (mLocalFileFetchToEncodedMemoryPrefetchSequence == null) {
      if (FrescoSystrace.isTracing()) {
        FrescoSystrace.beginSection(
            "ProducerSequenceFactory#getLocalFileFetchToEncodedMemoryPrefetchSequence:init");
      }
      mLocalFileFetchToEncodedMemoryPrefetchSequence =
          ProducerFactory.newSwallowResultProducer(
              getBackgroundLocalFileFetchToEncodeMemorySequence());
      if (FrescoSystrace.isTracing()) {
        FrescoSystrace.endSection();
      }
    }
    if (FrescoSystrace.isTracing()) {
      FrescoSystrace.endSection();
    }
    return mLocalFileFetchToEncodedMemoryPrefetchSequence;
  }
1097593
public ISynchronizationPoint<IOException> finishAsync() {
		if (finishing != null) return finishing;
		finishing = new SynchronizationPoint<>();
		Task<Void,NoException> task = new Task.Cpu<Void,NoException>("Finishing zip compression", priority) {
			@Override
			public Void run() {
				AsyncWork<Integer, IOException> lastWrite = null;
				deflater.finish();
				if (!deflater.finished()) {
					do {
						byte[] writeBuf = new byte[8192];
						int nb = deflater.deflate(writeBuf, 0, writeBuf.length);
						if (nb <= 0) break;
						try { lastWrite = writeOps.write(ByteBuffer.wrap(writeBuf, 0, nb)); }
						catch (IOException e) {
							finishing.error(e);
							return null;
						}
					} while (!deflater.finished());
				}
				if (lastWrite == null) lastWrite = writeOps.getLastPendingOperation();
				if (lastWrite != null)
					lastWrite.listenInline(finishing);
				else
					finishing.unblock();
				return null;
			}
		};
		task.start();
		return operation(finishing);
	}
978747
public int bwt() {
        final int[] SA = this.SA;
        final byte[] T = this.T;
        final int n = this.n;

        final int[] bucketA = new int[BUCKET_A_SIZE];
        final int[] bucketB = new int[BUCKET_B_SIZE];

        if (n == 0) {
            return 0;
        }
        if (n == 1) {
            SA[0] = T[0];
            return 0;
        }

        int m = sortTypeBstar(bucketA, bucketB);
        if (0 < m) {
            return constructBWT(bucketA, bucketB);
        }
        return 0;
    }
769590
byte[] getBuffer()
    {
        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) {
            trace.entry(this,
                        cclass,
                        "getBuffer");
            trace.exit(this,
                       cclass,
                       "getBuffer",
                       "return length="
                                       + buf.length);
        }
        return buf;
    }
181438
public JSONObject getFullPresence()
    {
        JSONObject game = getGameJson(this.game);
        return new JSONObject()
              .put("afk", idle)
              .put("since", System.currentTimeMillis())
              .put("game", game == null ? JSONObject.NULL : game)
              .put("status", getStatus().getKey());
    }