public abstract class ICompressor
extends java.lang.Object
implements java.io.Closeable, java.lang.AutoCloseable
限定符和类型 | 字段和说明 |
---|---|
static int |
DEFAULT
默认压缩器编号
|
构造器和说明 |
---|
ICompressor()
默认构造器方法
|
ICompressor(int compressionLevel)
构造器方法, 指定压缩参数和缓冲区
|
ICompressor(int compressionLevel,
int cacheSize)
构造器方法, 指定压缩参数和缓冲区
|
ICompressor(int compressionLevel,
edu.sysu.pmglab.container.VolumeByteStream cache)
构造器方法, 指定压缩参数和缓冲区
|
限定符和类型 | 方法和说明 |
---|---|
abstract void |
close()
关闭压缩器方法
|
int |
compress(byte[] src)
压缩方法, 压缩 src 数据, 并将压缩结果写入输出缓冲区
|
int |
compress(byte[] src,
int offset,
int length)
压缩方法, 压缩 src 数据, 并将压缩结果写入输出缓冲区
|
abstract int |
compress(byte[] src,
int srcOffset,
int srcLength,
byte[] dst,
int dstOffset,
int dstLength)
压缩方法, 压缩 src 数据, 并写入到 dst 中
|
int |
compress(byte[] src,
int offset,
int length,
edu.sysu.pmglab.container.VolumeByteStream dst)
压缩方法, 压缩 src 数据, 并将压缩结果写入缓冲区或源数据容器
|
static edu.sysu.pmglab.container.VolumeByteStream |
compress(int compressorIndex,
byte[] src,
int srcOffset,
int srcLength)
一次性压缩数据
|
static edu.sysu.pmglab.container.VolumeByteStream |
compress(int compressorIndex,
int compressionLevel,
byte[] src,
int srcOffset,
int srcLength)
一次性压缩数据
|
int |
compress(edu.sysu.pmglab.container.VolumeByteStream src)
压缩方法
|
int |
compress(edu.sysu.pmglab.container.VolumeByteStream src,
edu.sysu.pmglab.container.VolumeByteStream dst)
压缩方法
|
edu.sysu.pmglab.container.VolumeByteStream |
getCache()
直接获取缓冲区
|
abstract int |
getCompressBound(int length)
预估压缩后数据段大小
|
static int |
getCompressorIndex(java.lang.String compressorName)
获取压缩器索引
|
static java.lang.String |
getCompressorName(int compressorIndex)
获取压缩器名字
|
static java.lang.String[] |
getCompressorNames()
获取压缩器名字
|
abstract int |
getDefaultCompressionLevel()
获取默认压缩级别 (压缩参数)
|
static int |
getDefaultCompressionLevel(int compressorIndex)
获取默认压缩级别
|
static ICompressor |
getInstance(int compressorIndex,
int compressionLevel)
获取压缩器实例
|
static ICompressor |
getInstance(int compressorIndex,
int compressionLevel,
int cacheSize)
获取压缩器实例
|
static ICompressor |
getInstance(int compressorIndex,
int compressionLevel,
edu.sysu.pmglab.container.VolumeByteStream cache)
获取压缩器实例
|
abstract int |
getMaxCompressionLevel()
获取最大压缩级别 (压缩参数)
|
static int |
getMaxCompressionLevel(int compressorIndex)
获取最大压缩级别
|
abstract int |
getMinCompressionLevel()
获取最小压缩级别 (压缩参数)
|
static int |
getMinCompressionLevel(int compressorIndex)
获取最小压缩级别
|
void |
reset()
重设缓冲区
|
public static final int DEFAULT
public ICompressor()
public ICompressor(int compressionLevel)
compressionLevel
- 压缩器参数, 一般来说值越小速度越快, 越大则压缩比越高public ICompressor(int compressionLevel, int cacheSize)
compressionLevel
- 压缩器参数, 一般来说值越小速度越快, 越大则压缩比越高cacheSize
- 缓冲区大小public ICompressor(int compressionLevel, edu.sysu.pmglab.container.VolumeByteStream cache)
compressionLevel
- 压缩器参数, 一般来说值越小速度越快, 越大则压缩比越高cache
- 缓冲区public static ICompressor getInstance(int compressorIndex, int compressionLevel)
compressorIndex
- 压缩器索引compressionLevel
- 压缩级别public static ICompressor getInstance(int compressorIndex, int compressionLevel, int cacheSize)
compressorIndex
- 压缩器索引compressionLevel
- 压缩级别cacheSize
- 缓存数据大小public static ICompressor getInstance(int compressorIndex, int compressionLevel, edu.sysu.pmglab.container.VolumeByteStream cache)
compressorIndex
- 压缩器索引compressionLevel
- 压缩级别cache
- 缓存区public static int getMaxCompressionLevel(int compressorIndex)
compressorIndex
- 压缩器索引public static int getMinCompressionLevel(int compressorIndex)
compressorIndex
- 压缩器索引public static int getDefaultCompressionLevel(int compressorIndex)
compressorIndex
- 压缩器索引public static int getCompressorIndex(java.lang.String compressorName)
compressorName
- 压缩器名字public static java.lang.String getCompressorName(int compressorIndex)
compressorIndex
- 压缩器索引public static java.lang.String[] getCompressorNames()
public static edu.sysu.pmglab.container.VolumeByteStream compress(int compressorIndex, int compressionLevel, byte[] src, int srcOffset, int srcLength) throws java.io.IOException
compressorIndex
- 压缩器索引compressionLevel
- 压缩级别src
- 待压缩数据srcOffset
- 源数据偏移量srcLength
- 输入数据长度java.io.IOException
- IO 异常public static edu.sysu.pmglab.container.VolumeByteStream compress(int compressorIndex, byte[] src, int srcOffset, int srcLength) throws java.io.IOException
compressorIndex
- 压缩器索引src
- 待压缩数据srcOffset
- 源数据偏移量srcLength
- 输入数据长度java.io.IOException
- IO 异常public abstract int getCompressBound(int length)
length
- 输入数据长度public abstract int getMinCompressionLevel()
public abstract int getDefaultCompressionLevel()
public abstract int getMaxCompressionLevel()
public abstract int compress(byte[] src, int srcOffset, int srcLength, byte[] dst, int dstOffset, int dstLength) throws java.io.IOException
src
- 源数据srcOffset
- 源数据偏移量srcLength
- 源数据传入长度dst
- 目标容器dstOffset
- 目标容器偏移量dstLength
- 目标容器可用长度java.io.IOException
- IO 异常public abstract void close()
close
在接口中 java.io.Closeable
close
在接口中 java.lang.AutoCloseable
public edu.sysu.pmglab.container.VolumeByteStream getCache()
public int compress(byte[] src) throws java.io.IOException
src
- 字节数组java.io.IOException
- IO 异常public int compress(byte[] src, int offset, int length) throws java.io.IOException
src
- 字节数组offset
- 偏移量length
- 长度java.io.IOException
- IO 异常public int compress(edu.sysu.pmglab.container.VolumeByteStream src) throws java.io.IOException
src
- 源数据java.io.IOException
- IO 异常public int compress(edu.sysu.pmglab.container.VolumeByteStream src, edu.sysu.pmglab.container.VolumeByteStream dst) throws java.io.IOException
src
- 源数据dst
- 目标容器java.io.IOException
- IO 异常public int compress(byte[] src, int offset, int length, edu.sysu.pmglab.container.VolumeByteStream dst) throws java.io.IOException
src
- 字节数组offset
- 偏移量length
- 长度dst
- 目标容器java.io.IOException
- IO 异常public void reset()