final class PayloadUtil
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private static org.slf4j.Logger |
LOG |
static int |
MTU
The maximum transmission unit.
|
static java.lang.String |
URL_DELIMITER
Delmits URLS sent via heartbeats over sockets
|
(package private) static java.lang.String |
URL_DELIMITER_REGEXP
URL_DELIMITER as a regular expression. |
Modifier | Constructor and Description |
---|---|
private |
PayloadUtil()
Utility class therefore precent construction
|
Modifier and Type | Method and Description |
---|---|
static byte[] |
assembleUrlList(java.util.List localCachePeers)
Assembles a list of URLs
|
private static java.util.List<byte[]> |
createCompressedPayload(java.util.List<CachePeer> list,
int maxSizePerPayload)
Generates a list of compressed urlList's for the input CachePeers list.
|
static java.util.List<byte[]> |
createCompressedPayloadList(java.util.List<CachePeer> localCachePeers,
int maximumPeersPerSend)
Creates a list of compressed (using gzip) url list.
|
static byte[] |
gzip(byte[] ungzipped)
Gzips a byte[].
|
static byte[] |
ungzip(byte[] gzipped)
The fastest Ungzip implementation.
|
public static final int MTU
public static final java.lang.String URL_DELIMITER
static final java.lang.String URL_DELIMITER_REGEXP
URL_DELIMITER
as a regular expression. Package protected, used in tests onlyprivate static final org.slf4j.Logger LOG
public static java.util.List<byte[]> createCompressedPayloadList(java.util.List<CachePeer> localCachePeers, int maximumPeersPerSend)
MTU
and the number of url's in each compressed entry does not exceed the maximumPeersPerSend parameterlocalCachePeers
- List containing the peersmaximumPeersPerSend
- The maximum number of peers that can be present in one compressed entryprivate static java.util.List<byte[]> createCompressedPayload(java.util.List<CachePeer> list, int maxSizePerPayload)
list
- The list of CachePeers whose payload needs to be generatedmaxSizePerPayload
- The maximum size each payload can havepublic static byte[] assembleUrlList(java.util.List localCachePeers)
localCachePeers
- public static byte[] gzip(byte[] ungzipped)
ungzipped
- the bytes to be gzippedpublic static byte[] ungzip(byte[] gzipped)
gzipped
-