Class ResourceReader
java.lang.Object
com.github.natche.gravatarjavaclient.utils.ResourceReader
A class for reading resources given a
BufferedReader.-
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns whether the provided object is equal to this.static ResourceReaderfrom(BufferedReader resourceReader) Constructs and returns a new ResourceReader from the provided reader.inthashCode()Returns a hashcode representation of this object.static booleanisValidFilename(String filename) Returns whether the provided filename is valid for this operating system.Reads a chunked body from encapsulated reader.Skips any headers of the encapsulated reader.toString()Returns a string representation of this object.
-
Method Details
-
from
Constructs and returns a new ResourceReader from the provided reader.- Parameters:
resourceReader- the buffered reader to read the resource- Returns:
- a new ResourceReader object
- Throws:
NullPointerException- if the provided resourceReader is null
-
isValidFilename
Returns whether the provided filename is valid for this operating system.- Parameters:
filename- the filename- Returns:
- whether the provided filename is valid for this operating system
- Throws:
NullPointerException- if the provided filename is nullIllegalArgumentException- if the provided filename is empty
-
skipHeaders
Skips any headers of the encapsulated reader.- Returns:
- this reader
- Throws:
IOException- if an IO exception occurs
-
readChunkedBody
Reads a chunked body from encapsulated reader.- Returns:
- the complete response body
- Throws:
IOException- if an IO exception occursNumberFormatException- if the chunk size cannot be parsed
-
hashCode
public int hashCode()Returns a hashcode representation of this object. -
toString
Returns a string representation of this object. -
equals
Returns whether the provided object is equal to this.
-