Package org.atmosphere.cpr
Record Class AtmosphereRequestImpl.Body.StringBody
java.lang.Object
java.lang.Record
org.atmosphere.cpr.AtmosphereRequestImpl.Body.StringBody
- All Implemented Interfaces:
AtmosphereRequestImpl.Body
- Enclosing interface:
AtmosphereRequestImpl.Body
public static record AtmosphereRequestImpl.Body.StringBody(String data)
extends Record
implements AtmosphereRequestImpl.Body
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.atmosphere.cpr.AtmosphereRequestImpl.Body
AtmosphereRequestImpl.Body.BytesBody, AtmosphereRequestImpl.Body.EmptyBody, AtmosphereRequestImpl.Body.StringBody -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbyte[]asBytes()Return the request body as a byte array.asString()Return the request body as a String.intTheAtmosphereRequestImpl.Body.asBytes()lengthintTheAtmosphereRequestImpl.Body.asBytes()offsetdata()Returns the value of thedatarecord component.final booleanIndicates whether some other object is "equal to" this one.booleanhasBytes()True is the body is a byte arrayfinal inthashCode()Returns a hash code value for this object.booleanTrue is the body is a StringbooleanisEmpty()True if this object is emptyfinal StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
StringBody
Creates an instance of aStringBodyrecord class.- Parameters:
data- the value for thedatarecord component
-
-
Method Details
-
hasString
public boolean hasString()Description copied from interface:AtmosphereRequestImpl.BodyTrue is the body is a String- Specified by:
hasStringin interfaceAtmosphereRequestImpl.Body- Returns:
- True is the body is a String
-
hasBytes
public boolean hasBytes()Description copied from interface:AtmosphereRequestImpl.BodyTrue is the body is a byte array- Specified by:
hasBytesin interfaceAtmosphereRequestImpl.Body- Returns:
- True is the body is a byte array
-
asString
Description copied from interface:AtmosphereRequestImpl.BodyReturn the request body as a String. If the body was a byte array, this method will return null.- Specified by:
asStringin interfaceAtmosphereRequestImpl.Body- Returns:
- the request body as a String. If the body was a byte array, this method will return null.
-
asBytes
public byte[] asBytes()Description copied from interface:AtmosphereRequestImpl.BodyReturn the request body as a byte array. If the body was String, this method will return null.- Specified by:
asBytesin interfaceAtmosphereRequestImpl.Body- Returns:
- the request body as a byte array. If the body was String, this method will return null.
-
byteOffset
public int byteOffset()Description copied from interface:AtmosphereRequestImpl.BodyTheAtmosphereRequestImpl.Body.asBytes()offset- Specified by:
byteOffsetin interfaceAtmosphereRequestImpl.Body- Returns:
- The
AtmosphereRequestImpl.Body.asBytes()offset
-
byteLength
public int byteLength()Description copied from interface:AtmosphereRequestImpl.BodyTheAtmosphereRequestImpl.Body.asBytes()length- Specified by:
byteLengthin interfaceAtmosphereRequestImpl.Body- Returns:
- The
AtmosphereRequestImpl.Body.asBytes()length
-
isEmpty
public boolean isEmpty()Description copied from interface:AtmosphereRequestImpl.BodyTrue if this object is empty- Specified by:
isEmptyin interfaceAtmosphereRequestImpl.Body- Returns:
- True if this object is empty
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
data
Returns the value of thedatarecord component.- Returns:
- the value of the
datarecord component
-