Top Description Inners Fields Constructors Methods
com.sun.javafx.runtime.async

public abstract Class AbstractRemoteResource<T>

extends AbstractAsyncOperation<T>
Class Inheritance
Known Direct Subclasses
com.sun.javafx.tk.quantum.PrismImageLoader2.AsyncImageLoader
Imports
java.io.BufferedInputStream, .IOException, .InputStream, .InterruptedIOException, .OutputStream, java.net.HttpURLConnection, .URL, .URLConnection, java.util.HashMap, .Iterator, .List, .Map

Abstract base class for representing remote resources identified by a URL. Subclasses may plug in arbitrary post-processing on the stream to turn it into the desired result. Manages progress indication if the remote resource provides a content-length header.

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected class

Field Summary

Modifier and TypeField and Description
protected int
private Map<String, String>
protected final String
protected final String
private Map<String, List<String>>
protected final String
Inherited from com.sun.javafx.runtime.async.AbstractAsyncOperation:
futurelistener

Constructor Summary

AccessConstructor and Description
protected
protected
protected
AbstractRemoteResource(String url, String method, String outboundContent, AsyncOperationListener<T> listener)

Method Summary

Modifier and TypeMethod and Description
public T
call()

Implements java.util.concurrent.Callable.call.

Computes a result, or throws an exception if unable to do so.

public String
protected abstract T
public void
setHeader(String header, String value)

Inherited from com.sun.javafx.runtime.async.AbstractAsyncOperation:
addProgresscancelgetProgressGranularitygetProgressMaxisCancelledisDonenotifyProgresssetProgressGranularitysetProgressMaxstart

Field Detail

fileSizeback to summary
protected int fileSize
headersback to summary
private Map<String, String> headers
methodback to summary
protected final String method
outboundContentback to summary
protected final String outboundContent
responseHeadersback to summary
private Map<String, List<String>> responseHeaders
urlback to summary
protected final String url

Constructor Detail

AbstractRemoteResourceback to summary
protected AbstractRemoteResource(String url, AsyncOperationListener<T> listener)
AbstractRemoteResourceback to summary
protected AbstractRemoteResource(String url, String method, AsyncOperationListener<T> listener)
AbstractRemoteResourceback to summary
protected AbstractRemoteResource(String url, String method, String outboundContent, AsyncOperationListener<T> listener)

Method Detail

callback to summary
public T call() throws IOException

Implements java.util.concurrent.Callable.call.

Doc from java.util.concurrent.Callable.call.

Computes a result, or throws an exception if unable to do so.

Annotations
@Override
getResponseHeaderback to summary
public String getResponseHeader(String header)
processStreamback to summary
protected abstract T processStream(InputStream stream) throws IOException
setHeaderback to summary
public void setHeader(String header, String value)
com.sun.javafx.runtime.async back to summary

protected Class AbstractRemoteResource.ProgressInputStream

extends BufferedInputStream
Class Inheritance

Field Summary

Inherited from java.io.BufferedInputStream:
bufcountmarklimitmarkpospos

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public synchronized int
read()

Overrides java.io.BufferedInputStream.read.

See the general contract of the read method of InputStream.

public synchronized int
read(byte[] b, int off, int len)

Overrides java.io.BufferedInputStream.read.

Reads bytes from this byte-input stream into the specified byte array, starting at the given offset.

public int
read(byte[] b)

Overrides java.io.FilterInputStream.read.

Reads up to b.length bytes of data from this input stream into an array of bytes.

Inherited from java.io.BufferedInputStream:
availableclosemarkmarkSupportedresetskiptransferTo

Constructor Detail

ProgressInputStreamback to summary
public ProgressInputStream(InputStream in)

Method Detail

readback to summary
public synchronized int read() throws IOException

Overrides java.io.BufferedInputStream.read.

Doc from java.io.BufferedInputStream.read.

See the general contract of the read method of InputStream.

Annotations
@Override
Exceptions
IOException:
if this input stream has been closed by invoking its close() method, or an I/O error occurs.
readback to summary
public synchronized int read(byte[] b, int off, int len) throws IOException

Overrides java.io.BufferedInputStream.read.

Doc from java.io.BufferedInputStream.read.

Reads bytes from this byte-input stream into the specified byte array, starting at the given offset.

This method implements the general contract of the corresponding read method of the InputStream class. As an additional convenience, it attempts to read as many bytes as possible by repeatedly invoking the read method of the underlying stream. This iterated read continues until one of the following conditions becomes true:

  • The specified number of bytes have been read,
  • The read method of the underlying stream returns -1, indicating end-of-file, or
  • The available method of the underlying stream returns zero, indicating that further input requests would block.
If the first read on the underlying stream returns -1 to indicate end-of-file then this method returns -1. Otherwise, this method returns the number of bytes actually read.

Subclasses of this class are encouraged, but not required, to attempt to read as many bytes as possible in the same fashion.

Annotations
@Override
Exceptions
IOException:
if this input stream has been closed by invoking its close() method, or an I/O error occurs.
readback to summary
public int read(byte[] b) throws IOException

Overrides java.io.FilterInputStream.read.

Doc from java.io.FilterInputStream.read.

Reads up to b.length bytes of data from this input stream into an array of bytes. This method blocks until some input is available.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs.