Class ChunkSessionInformation
java.lang.Object
eu.cloudnetservice.driver.network.chunk.ChunkSessionInformation
- All Implemented Interfaces:
DataBufable,Closeable,AutoCloseable
Contains all needed information for a chunked data transfer to be initialized. The transfer information in this
object are there to allow writes of additional information needed for the transfer to work, for example the target
file name.
- Since:
- 4.0
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintGet the size of a single chunk in the transfer.voidclose()booleaninthashCode()voidReads all data of this object from the given buffer.Get the session unique id.toString()Get the transfer channel identifier.Get the buffer containing additional information about the transfer.voidwriteData(DataBuf.Mutable dataBuf) Writes all needed data from this object into the given data buf.
-
Field Details
-
chunkSize
private int chunkSize -
sessionUniqueId
-
transferChannel
-
transferInformation
-
-
Constructor Details
-
ChunkSessionInformation
Used for network deserialization. -
ChunkSessionInformation
public ChunkSessionInformation(int chunkSize, @NonNull @NonNull UUID sessionUniqueId, @NonNull @NonNull String transferChannel, @NonNull @NonNull DataBuf transferInformation) Constructs a new chunk session information.- Parameters:
chunkSize- the size of data transferred in each chunk, should always be the exact amount of bytes.sessionUniqueId- the unique id of the transfer session, for identification reasons.transferChannel- the name of the channel the data is transferred in, for identification reasons.transferInformation- additional information for the transfer handler to handle the chunks correctly.- Throws:
NullPointerException- if the given session id, transfer channel or transfer information buffer is null.
-
-
Method Details
-
writeData
Writes all needed data from this object into the given data buf.- Specified by:
writeDatain interfaceDataBufable- Parameters:
dataBuf- the buffer to write the data to.
-
readData
Reads all data of this object from the given buffer. The deserializer uses the no-args constructor which must be available in this class and creates an empty instance of this class. This method is then responsible to fill the object data.The given buffer should NEVER be read from more than written into the buffer in the write method.
- Specified by:
readDatain interfaceDataBufable- Parameters:
dataBuf- the data buf to read the class data from.
-
chunkSize
public int chunkSize()Get the size of a single chunk in the transfer.- Returns:
- the size of a single chunk in the transfer.
-
sessionUniqueId
-
transferChannel
-
transferInformation
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
equals
-
hashCode
-
toString
-