Class PagedResultsDecorator
- java.lang.Object
-
- org.apache.directory.api.ldap.codec.api.ControlDecorator<PagedResults>
-
- org.apache.directory.api.ldap.codec.controls.search.pagedSearch.PagedResultsDecorator
-
- All Implemented Interfaces:
Asn1Object
,CodecControl<PagedResults>
,Decorator<PagedResults>
,Control
,PagedResults
public class PagedResultsDecorator extends ControlDecorator<PagedResults> implements PagedResults
A codec decorator for thePagedResultsImpl
.- Author:
- Apache Directory Project
-
-
Field Summary
-
Fields inherited from interface org.apache.directory.api.ldap.model.message.controls.PagedResults
OID
-
-
Constructor Summary
Constructors Constructor Description PagedResultsDecorator(LdapApiService codec)
Creates a new instance of PagedResultsDecorator with a newly created decorated PagedResults Control.PagedResultsDecorator(LdapApiService codec, PagedResults pagedResults)
Creates a new instance of PagedResultsDecorator using the supplied PagedResults Control to be decorated.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
computeLength()
Compute the PagedSearchControl length, which is the sum of the control length and the value length.Asn1Object
decode(byte[] controlBytes)
Decodes raw ASN.1 encoded bytes into an Asn1Object for the control.ByteBuffer
encode(ByteBuffer buffer)
Encodes the paged search control.boolean
equals(Object o)
byte[]
getCookie()
int
getCookieValue()
int
getSize()
byte[]
getValue()
Get the control valueint
hashCode()
void
setCookie(byte[] cookie)
Set the cookievoid
setSize(int size)
Set the number of entry requested or returnedString
toString()
Return a String representing this PagedSearchControl.-
Methods inherited from class org.apache.directory.api.ldap.codec.api.ControlDecorator
getCodecService, getDecorated, getOid, hasValue, isCritical, setCritical, setDecorated, setValue
-
Methods inherited from interface org.apache.directory.api.ldap.model.message.Control
getOid, isCritical, setCritical
-
-
-
-
Constructor Detail
-
PagedResultsDecorator
public PagedResultsDecorator(LdapApiService codec)
Creates a new instance of PagedResultsDecorator with a newly created decorated PagedResults Control.- Parameters:
codec
- The LDAP service instance
-
PagedResultsDecorator
public PagedResultsDecorator(LdapApiService codec, PagedResults pagedResults)
Creates a new instance of PagedResultsDecorator using the supplied PagedResults Control to be decorated.- Parameters:
codec
- The LDAP service instancepagedResults
- The PagedResults Control to be decorated.
-
-
Method Detail
-
computeLength
public int computeLength()
Compute the PagedSearchControl length, which is the sum of the control length and the value length.PagedSearchControl value length : 0x30 L1 | +--> 0x02 0x0(1-4) [0..2^63-1] (size) +--> 0x04 L2 (cookie)
- Specified by:
computeLength
in interfaceAsn1Object
- Returns:
- the control length.
-
encode
public ByteBuffer encode(ByteBuffer buffer) throws EncoderException
Encodes the paged search control.- Specified by:
encode
in interfaceAsn1Object
- Parameters:
buffer
- The encoded sink- Returns:
- A ByteBuffer that contains the encoded PDU
- Throws:
EncoderException
- If anything goes wrong.
-
getValue
public byte[] getValue()
Get the control value- Specified by:
getValue
in interfaceCodecControl<PagedResults>
- Overrides:
getValue
in classControlDecorator<PagedResults>
- Returns:
- The control value
-
getSize
public int getSize()
- Specified by:
getSize
in interfacePagedResults
- Returns:
- The requested or returned number of entries
-
setSize
public void setSize(int size)
Set the number of entry requested or returned- Specified by:
setSize
in interfacePagedResults
- Parameters:
size
- The number of entries
-
getCookie
public byte[] getCookie()
- Specified by:
getCookie
in interfacePagedResults
- Returns:
- The stored cookie
-
setCookie
public void setCookie(byte[] cookie)
Set the cookie- Specified by:
setCookie
in interfacePagedResults
- Parameters:
cookie
- The cookie to store in this control
-
getCookieValue
public int getCookieValue()
- Specified by:
getCookieValue
in interfacePagedResults
- Returns:
- The integer value for the current cookie
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classControlDecorator<PagedResults>
- See Also:
Object.hashCode()
-
equals
public boolean equals(Object o)
- Overrides:
equals
in classControlDecorator<PagedResults>
- See Also:
Object.equals(Object)
-
toString
public String toString()
Return a String representing this PagedSearchControl.- Overrides:
toString
in classControlDecorator<PagedResults>
-
decode
public Asn1Object decode(byte[] controlBytes) throws DecoderException
Decodes raw ASN.1 encoded bytes into an Asn1Object for the control.- Specified by:
decode
in interfaceCodecControl<PagedResults>
- Parameters:
controlBytes
- the encoded control bytes- Returns:
- the decoded Asn1Object for the control
- Throws:
DecoderException
- if anything goes wrong
-
-