@Test public void testGetCompress() { CompressManager compressManager = CompressManager.getInstance(); Compress compress = compressManager.getCompress(Options.CompressType.COMPRESS_TYPE_NONE_VALUE); Assert.assertNotNull(compress); compress = compressManager.getCompress(Options.CompressType.COMPRESS_TYPE_GZIP_VALUE); Assert.assertNotNull(compress); }
public Compress getCompress(int compressType) { if (compressType < 0 || compressType >= compressNum) { throw new RuntimeException("out of bound"); } Compress compress = compressArray[compressType]; if (compress == null) { String errMsg = String.format("compress type=%d not support", compressType); log.warn(errMsg); throw new RuntimeException(errMsg); } return compress; }
CompressManager { public Compress getCompress(int compressType) { if (compressType < 0 || compressType >= compressNum) { throw new RuntimeException("out of bound"); } Compress compress = compressArray[compressType]; if (compress == null) { String errMsg = String.format("compress type=%d not support", compressType); log.warn(errMsg); throw new RuntimeException(errMsg); } return compress; } }
CompressManager { public Compress getCompress(int compressType) { if (compressType < 0 || compressType >= compressNum) { throw new RuntimeException("out of bound"); } Compress compress = compressArray[compressType]; if (compress == null) { String errMsg = String.format("compress type=%d not support", compressType); log.warn(errMsg); throw new RuntimeException(errMsg); } return compress; } private  CompressManager(); }
CompressManager { public Compress getCompress(int compressType) { if (compressType < 0 || compressType >= compressNum) { throw new RuntimeException("out of bound"); } Compress compress = compressArray[compressType]; if (compress == null) { String errMsg = String.format("compress type=%d not support", compressType); log.warn(errMsg); throw new RuntimeException(errMsg); } return compress; } private  CompressManager(); static CompressManager getInstance(); Compress getCompress(int compressType); }
CompressManager { public Compress getCompress(int compressType) { if (compressType < 0 || compressType >= compressNum) { throw new RuntimeException("out of bound"); } Compress compress = compressArray[compressType]; if (compress == null) { String errMsg = String.format("compress type=%d not support", compressType); log.warn(errMsg); throw new RuntimeException(errMsg); } return compress; } private  CompressManager(); static CompressManager getInstance(); Compress getCompress(int compressType);  }