Package org.dcache.xrootd.stream
Class AbstractChunkedReadvResponse
- java.lang.Object
-
- org.dcache.xrootd.stream.AbstractChunkedReadvResponse
-
- All Implemented Interfaces:
ChunkedResponse
- Direct Known Subclasses:
ChunkedFileChannelReadvResponse,ChunkedFileReadvResponse
public abstract class AbstractChunkedReadvResponse extends java.lang.Object implements ChunkedResponse
-
-
Field Summary
Fields Modifier and Type Field Description protected intindexprotected intmaxFrameSizeprotected ReadVRequestrequestprotected GenericReadRequestMessage.EmbeddedReadRequest[]requests
-
Constructor Summary
Constructors Constructor Description AbstractChunkedReadvResponse(ReadVRequest 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.protected abstract longgetSize(int fd)booleanisEndOfInput()Returntrueif and only if there is no data left in the stream and the stream has reached its end.ReadVResponsenextChunk(io.netty.buffer.ByteBufAllocator alloc)Fetches a chunk from the stream.protected abstract io.netty.buffer.ByteBufread(io.netty.buffer.ByteBufAllocator alloc, int fd, long position, int length)
-
-
-
Field Detail
-
request
protected final ReadVRequest request
-
maxFrameSize
protected final int maxFrameSize
-
requests
protected final GenericReadRequestMessage.EmbeddedReadRequest[] requests
-
index
protected int index
-
-
Constructor Detail
-
AbstractChunkedReadvResponse
public AbstractChunkedReadvResponse(ReadVRequest 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 ReadVResponse 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
-
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
-
getSize
protected abstract long getSize(int fd) throws java.io.IOException, XrootdException- Throws:
java.io.IOExceptionXrootdException
-
read
protected abstract io.netty.buffer.ByteBuf read(io.netty.buffer.ByteBufAllocator alloc, int fd, long position, int length) throws java.io.IOException, XrootdException- Throws:
java.io.IOExceptionXrootdException
-
-