Package org.dcache.xrootd.stream
Class AbstractChunkedReadResponse
- java.lang.Object
-
- org.dcache.xrootd.stream.AbstractChunkedReadResponse
-
- All Implemented Interfaces:
ChunkedResponse
- Direct Known Subclasses:
ChunkedFileChannelReadResponse
public abstract class AbstractChunkedReadResponse extends java.lang.Object implements ChunkedResponse
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanisEndOfInputprotected intlengthprotected intmaxFrameSizeprotected longpositionprotected ReadRequestrequest
-
Constructor Summary
Constructors Constructor Description AbstractChunkedReadResponse(ReadRequest request, int maxFrameSize)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidclose()Releases the resources associated with the stream.XrootdRequestgetRequest()Returns the request this is a response to.booleanisEndOfInput()Returntrueif and only if there is no data left in the stream and the stream has reached its end.ReadResponsenextChunk(io.netty.buffer.ByteBufAllocator alloc)Fetches a chunk from the stream.protected abstract io.netty.buffer.ByteBufread(io.netty.buffer.ByteBufAllocator alloc, long srcIndex, int length)
-
-
-
Field Detail
-
request
protected final ReadRequest request
-
maxFrameSize
protected final int maxFrameSize
-
position
protected long position
-
length
protected int length
-
isEndOfInput
protected boolean isEndOfInput
-
-
Constructor Detail
-
AbstractChunkedReadResponse
public AbstractChunkedReadResponse(ReadRequest request, int maxFrameSize)
-
-
Method Detail
-
getRequest
public XrootdRequest getRequest()
Description copied from interface:ChunkedResponseReturns the request this is a response to.- Specified by:
getRequestin interfaceChunkedResponse
-
nextChunk
public ReadResponse nextChunk(io.netty.buffer.ByteBufAllocator alloc) throws java.lang.Exception
Description copied from interface:ChunkedResponseFetches a chunk from the stream.- Specified by:
nextChunkin interfaceChunkedResponse- Returns:
- the fetched chunk
- Throws:
java.lang.Exception
-
read
protected abstract io.netty.buffer.ByteBuf read(io.netty.buffer.ByteBufAllocator alloc, long srcIndex, int length) throws java.io.IOException- Throws:
java.io.IOException
-
isEndOfInput
public boolean isEndOfInput() throws java.lang.ExceptionDescription copied from interface:ChunkedResponseReturntrueif and only if there is no data left in the stream and the stream has reached its end.- Specified by:
isEndOfInputin interfaceChunkedResponse- Throws:
java.lang.Exception
-
close
public void close() throws java.lang.ExceptionDescription copied from interface:ChunkedResponseReleases the resources associated with the stream.- Specified by:
closein interfaceChunkedResponse- Throws:
java.lang.Exception
-
-