TypedRest for Java
Public Member Functions | List of all members
net.typedrest.BlobEndpoint Interface Reference

REST endpoint that represents a single binary blob that can downloaded and uploaded. More...

Inheritance diagram for net.typedrest.BlobEndpoint:
net.typedrest.Endpoint net.typedrest.BlobEndpointImpl

Public Member Functions

void probe () throws IOException, IllegalArgumentException, IllegalAccessException, FileNotFoundException, IllegalStateException
 Queries the server about capabilities of the endpoint without performing any action. More...
 
Optional< Boolean > isDownloadAllowed ()
 Shows whether the server has indicated that download() is currently allowed. More...
 
InputStream download () throws IOException, IllegalArgumentException, IllegalAccessException, FileNotFoundException, IllegalStateException
 Downloads the blob's content. More...
 
Optional< Boolean > isUploadAllowed ()
 Shows whether the server has indicated that upload(java.io.InputStream, org.apache.http.entity.ContentType) is currently allowed. More...
 
void upload (InputStream stream, ContentType contentType) throws IOException, IllegalArgumentException, IllegalAccessException, FileNotFoundException
 Uploads new content for the blob. More...
 
void upload (byte[] data, ContentType contentType) throws IOException, IllegalArgumentException, IllegalAccessException, FileNotFoundException
 Uploads a byte array as the blob's content. More...
 
void upload (File file, ContentType contentType) throws IOException, IllegalArgumentException, IllegalAccessException, FileNotFoundException, IllegalStateException
 Uploads a local file as the blob's content. More...
 
Optional< Boolean > isDeleteAllowed ()
 Shows whether the server has indicated that delete() is currently allowed. More...
 
void delete () throws IOException, IllegalArgumentException, IllegalAccessException, FileNotFoundException
 Deletes the blob from the server. More...
 
- Public Member Functions inherited from net.typedrest.Endpoint
URI getUri ()
 The HTTP URI of the remote resource. More...
 
Executor getExecutor ()
 The REST executor used to communicate with the remote resource. More...
 
ObjectMapper getSerializer ()
 Controls the serialization of entities sent to and received from the server. More...
 
Set< URI > getLinks (String rel)
 Retrieves all links with a specific relation type cached from the last request. More...
 
Map< URI, String > getLinksWithTitles (String rel)
 Retrieves all links (with titles) with a specific relation type cached from the last request. More...
 
URI link (String rel)
 Retrieves a single link with a specific relation type. More...
 
UriTemplate linkTemplate (String rel)
 Retrieves a link template with a specific relation type. More...
 
default URI linkTemplate (String rel, String variableName, Object value)
 Retrieves a link template with a specific relation type and resolves it. More...
 

Detailed Description

REST endpoint that represents a single binary blob that can downloaded and uploaded.

Member Function Documentation

◆ delete()

void net.typedrest.BlobEndpoint.delete ( ) throws IOException, IllegalArgumentException, IllegalAccessException, FileNotFoundException

Deletes the blob from the server.

Exceptions
IOExceptionNetwork communication failed.
IllegalArgumentExceptionHttpStatus#SC_BAD_REQUEST
IllegalAccessExceptionHttpStatus#SC_UNAUTHORIZED or HttpStatus#SC_FORBIDDEN
FileNotFoundExceptionHttpStatus#SC_NOT_FOUND or HttpStatus#SC_GONE
IllegalStateExceptionHttpStatus#SC_CONFLICT
RuntimeExceptionOther non-success status code.

Implemented in net.typedrest.BlobEndpointImpl.

◆ download()

InputStream net.typedrest.BlobEndpoint.download ( ) throws IOException, IllegalArgumentException, IllegalAccessException, FileNotFoundException, IllegalStateException

Downloads the blob's content.

Returns
A stream with the blob's content.
Exceptions
IOExceptionNetwork communication failed.
IllegalArgumentExceptionHttpStatus#SC_BAD_REQUEST
IllegalAccessExceptionHttpStatus#SC_UNAUTHORIZED or HttpStatus#SC_FORBIDDEN
FileNotFoundExceptionHttpStatus#SC_NOT_FOUND or HttpStatus#SC_GONE
IllegalStateExceptionHttpStatus#SC_CONFLICT
RuntimeExceptionOther non-success status code.

Implemented in net.typedrest.BlobEndpointImpl.

◆ isDeleteAllowed()

Optional<Boolean> net.typedrest.BlobEndpoint.isDeleteAllowed ( )

Shows whether the server has indicated that delete() is currently allowed.

Uses cached data from last response.

Returns
An indicator whether the method is allowed. If no request has been sent yet or the server did not specify allowed methods Optional#empty() is returned.

Implemented in net.typedrest.BlobEndpointImpl.

◆ isDownloadAllowed()

Optional<Boolean> net.typedrest.BlobEndpoint.isDownloadAllowed ( )

Shows whether the server has indicated that download() is currently allowed.

Uses cached data from last response.

Returns
An indicator whether the method is allowed. If no request has been sent yet or the server did not specify allowed methods Optional#empty() is returned.

Implemented in net.typedrest.BlobEndpointImpl.

◆ isUploadAllowed()

Optional<Boolean> net.typedrest.BlobEndpoint.isUploadAllowed ( )

Shows whether the server has indicated that upload(java.io.InputStream, org.apache.http.entity.ContentType) is currently allowed.

Uses cached data from last response.

Returns
An indicator whether the method is allowed. If no request has been sent yet or the server did not specify allowed methods Optional#empty() is returned.

Implemented in net.typedrest.BlobEndpointImpl.

◆ probe()

void net.typedrest.BlobEndpoint.probe ( ) throws IOException, IllegalArgumentException, IllegalAccessException, FileNotFoundException, IllegalStateException

Queries the server about capabilities of the endpoint without performing any action.

Exceptions
IOExceptionNetwork communication failed.
IllegalArgumentExceptionHttpStatus#SC_BAD_REQUEST
IllegalAccessExceptionHttpStatus#SC_UNAUTHORIZED or HttpStatus#SC_FORBIDDEN
FileNotFoundExceptionHttpStatus#SC_NOT_FOUND or HttpStatus#SC_GONE
IllegalStateExceptionHttpStatus#SC_CONFLICT
RuntimeExceptionOther non-success status code.

Implemented in net.typedrest.BlobEndpointImpl.

◆ upload() [1/3]

void net.typedrest.BlobEndpoint.upload ( InputStream  stream,
ContentType  contentType 
) throws IOException, IllegalArgumentException, IllegalAccessException, FileNotFoundException

Uploads new content for the blob.

Parameters
streamA stream with the blob's new content.
contentTypeThe MIME type of the file to upload.
Exceptions
IOExceptionNetwork communication failed.
IllegalArgumentExceptionHttpStatus#SC_BAD_REQUEST
IllegalAccessExceptionHttpStatus#SC_UNAUTHORIZED or HttpStatus#SC_FORBIDDEN
FileNotFoundExceptionHttpStatus#SC_NOT_FOUND or HttpStatus#SC_GONE
IllegalStateExceptionHttpStatus#SC_CONFLICT
RuntimeExceptionOther non-success status code.

Implemented in net.typedrest.BlobEndpointImpl.

◆ upload() [2/3]

void net.typedrest.BlobEndpoint.upload ( byte []  data,
ContentType  contentType 
) throws IOException, IllegalArgumentException, IllegalAccessException, FileNotFoundException

Uploads a byte array as the blob's content.

Parameters
dataThe byte array holding the data to upload.
contentTypeThe MIME type of the file to upload.
Exceptions
IOExceptionNetwork communication failed.
IllegalArgumentExceptionHttpStatus#SC_BAD_REQUEST
IllegalAccessExceptionHttpStatus#SC_UNAUTHORIZED or HttpStatus#SC_FORBIDDEN
FileNotFoundExceptionHttpStatus#SC_NOT_FOUND or HttpStatus#SC_GONE
IllegalStateExceptionHttpStatus#SC_CONFLICT
RuntimeExceptionOther non-success status code.

Implemented in net.typedrest.BlobEndpointImpl.

◆ upload() [3/3]

void net.typedrest.BlobEndpoint.upload ( File  file,
ContentType  contentType 
) throws IOException, IllegalArgumentException, IllegalAccessException, FileNotFoundException, IllegalStateException

Uploads a local file as the blob's content.

Parameters
fileThe local file to read the data from.
contentTypeThe MIME type of the file to upload.
Exceptions
IOExceptionNetwork communication failed.
IllegalArgumentExceptionHttpStatus#SC_BAD_REQUEST
IllegalAccessExceptionHttpStatus#SC_UNAUTHORIZED or HttpStatus#SC_FORBIDDEN
FileNotFoundExceptionHttpStatus#SC_NOT_FOUND or HttpStatus#SC_GONE
IllegalStateExceptionHttpStatus#SC_CONFLICT
RuntimeExceptionOther non-success status code.

Implemented in net.typedrest.BlobEndpointImpl.


The documentation for this interface was generated from the following file: