本文整理了Java中org.apache.flink.configuration.Configuration.getBytes()
方法的一些代码示例,展示了Configuration.getBytes()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Configuration.getBytes()
方法的具体详情如下:
包路径:org.apache.flink.configuration.Configuration
类名称:Configuration
方法名:getBytes
[英]Returns the value associated with the given key as a byte array.
[中]以字节数组的形式返回与给定键关联的值。
代码示例来源:origin: apache/flink
@Override
public byte[] getBytes(final String key, final byte[] defaultValue) {
return this.backingConfig.getBytes(this.prefix + key, defaultValue);
}
代码示例来源:origin: apache/flink
public byte[] getSerializedStateBackend() {
return this.config.getBytes(STATE_BACKEND, null);
}
代码示例来源:origin: apache/flink
public static <T> T readObjectFromConfig(Configuration config, String key, ClassLoader cl) throws IOException, ClassNotFoundException {
byte[] bytes = config.getBytes(key, null);
if (bytes == null) {
return null;
}
return deserializeObject(bytes, cl);
}
代码示例来源:origin: apache/flink
public OperatorID getOperatorID() {
byte[] operatorIDBytes = config.getBytes(OPERATOR_ID, null);
return new OperatorID(Preconditions.checkNotNull(operatorIDBytes));
}
代码示例来源:origin: apache/flink
public static Set<Entry<String, DistributedCacheEntry>> readFileInfoFromConfig(Configuration conf) {
int num = conf.getInteger(CACHE_FILE_NUM, 0);
if (num == 0) {
return Collections.emptySet();
}
Map<String, DistributedCacheEntry> cacheFiles = new HashMap<String, DistributedCacheEntry>();
for (int i = 1; i <= num; i++) {
String name = conf.getString(CACHE_FILE_NAME + i, null);
String filePath = conf.getString(CACHE_FILE_PATH + i, null);
boolean isExecutable = conf.getBoolean(CACHE_FILE_EXE + i, false);
boolean isDirectory = conf.getBoolean(CACHE_FILE_DIR + i, false);
byte[] blobKey = conf.getBytes(CACHE_FILE_BLOB_KEY + i, null);
cacheFiles.put(name, new DistributedCacheEntry(filePath, isExecutable, blobKey, isDirectory));
}
return cacheFiles.entrySet();
}
代码示例来源:origin: apache/flink
assertEquals(Math.E, copy.getDouble("E", 0.0), 0.0);
assertEquals(true, copy.getBoolean("shouldbetrue", false));
assertArrayEquals(new byte[] { 1, 2, 3, 4, 5 }, copy.getBytes("bytes sequence", null));
assertEquals(getClass(), copy.getClass("myclass", null, getClass().getClassLoader()));
代码示例来源:origin: apache/flink
assertEquals(false, pc.getBoolean("int", true));
assertEquals("5", pc.getString("int", "0"));
assertArrayEquals(EMPTY_BYTES, pc.getBytes("int", EMPTY_BYTES));
assertEquals(false, pc.getBoolean("long", true));
assertEquals("15", pc.getString("long", "0"));
assertArrayEquals(EMPTY_BYTES, pc.getBytes("long", EMPTY_BYTES));
assertEquals(false, pc.getBoolean("too_long", true));
assertEquals(String.valueOf(TOO_LONG), pc.getString("too_long", "0"));
assertArrayEquals(EMPTY_BYTES, pc.getBytes("too_long", EMPTY_BYTES));
assertEquals(false, pc.getBoolean("float", true));
assertTrue(pc.getString("float", "0").startsWith("2.145677"));
assertArrayEquals(EMPTY_BYTES, pc.getBytes("float", EMPTY_BYTES));
assertEquals(false, pc.getBoolean("double", true));
assertTrue(pc.getString("double", "0").startsWith("3.1415926535"));
assertArrayEquals(EMPTY_BYTES, pc.getBytes("double", EMPTY_BYTES));
assertEquals(false, pc.getBoolean("negative_double", true));
assertTrue(pc.getString("negative_double", "0").startsWith("-1"));
assertArrayEquals(EMPTY_BYTES, pc.getBytes("negative_double", EMPTY_BYTES));
assertEquals(false, pc.getBoolean("zero", true));
assertTrue(pc.getString("zero", "-1").startsWith("0"));
assertArrayEquals(EMPTY_BYTES, pc.getBytes("zero", EMPTY_BYTES));
assertEquals(false, pc.getBoolean("too_long_double", true));
代码示例来源:origin: org.apache.flink/flink-core
@Override
public byte[] getBytes(final String key, final byte[] defaultValue) {
return this.backingConfig.getBytes(this.prefix + key, defaultValue);
}
代码示例来源:origin: org.apache.flink/flink-streaming-java_2.10
public byte[] getSerializedStateBackend() {
return this.config.getBytes(STATE_BACKEND, null);
}
代码示例来源:origin: org.apache.flink/flink-streaming-java_2.11
public byte[] getSerializedStateBackend() {
return this.config.getBytes(STATE_BACKEND, null);
}
代码示例来源:origin: org.apache.flink/flink-core
public static <T> T readObjectFromConfig(Configuration config, String key, ClassLoader cl) throws IOException, ClassNotFoundException {
byte[] bytes = config.getBytes(key, null);
if (bytes == null) {
return null;
}
return deserializeObject(bytes, cl);
}
代码示例来源:origin: com.alibaba.blink/flink-core
public static <T> T readObjectFromConfig(Configuration config, String key, ClassLoader cl) throws IOException, ClassNotFoundException {
byte[] bytes = config.getBytes(key, null);
if (bytes == null) {
return null;
}
return deserializeObject(bytes, cl);
}
代码示例来源:origin: org.apache.flink/flink-streaming-java_2.11
public OperatorID getOperatorID() {
byte[] operatorIDBytes = config.getBytes(OPERATOR_ID, null);
return new OperatorID(Preconditions.checkNotNull(operatorIDBytes));
}
代码示例来源:origin: amidst/toolbox
@Override
public void open(Configuration parameters) throws Exception {
super.open(parameters);
svb = Serialization.deserializeObject(parameters.getBytes(SVB, null));
svb.initLearning();
latentVariables = Serialization.deserializeObject(parameters.getBytes(LATENT_VARS, null));
}
}
代码示例来源:origin: amidst/toolbox
@Override
public void open(Configuration parameters) throws Exception {
super.open(parameters);
svb = Serialization.deserializeObject(parameters.getBytes(SVB, null));
svb.initLearning();
latentVariables = Serialization.deserializeObject(parameters.getBytes(LATENT_VARS, null));
}
}
代码示例来源:origin: amidst/toolbox
@Override
public void open(Configuration parameters) throws Exception {
super.open(parameters);
svb = Serialization.deserializeObject(parameters.getBytes(SVB, null));
svb.initLearning();
latentVariables = Serialization.deserializeObject(parameters.getBytes(LATENT_VARS, null));
}
}
代码示例来源:origin: amidst/toolbox
@Override
public void open(Configuration parameters) throws Exception {
super.open(parameters);
svb = Serialization.deserializeObject(parameters.getBytes(SVB, null));
svb.initLearning();
latentVariables = Serialization.deserializeObject(parameters.getBytes(LATENT_VARS, null));
}
}
代码示例来源:origin: amidst/toolbox
@Override
public void open(Configuration parameters) throws Exception {
super.open(parameters);
svb = Serialization.deserializeObject(parameters.getBytes(SVB, null));
this.prior = Serialization.deserializeObject(parameters.getBytes(PRIOR, null));
svb.initLearning();
this.svb.updateNaturalParameterPrior(prior);
this.svb.updateNaturalParameterPosteriors(prior);
svb.getPlateuStructure().getNonReplictedNodes().forEach(node -> node.setActive(false));
}
代码示例来源:origin: amidst/toolbox
@Override
public void open(Configuration parameters) throws Exception {
super.open(parameters);
String bnName = parameters.getString(BN_NAME, "");
ef_bayesianNetwork = Serialization.deserializeObject(parameters.getBytes(EFBN_NAME,null));
getRuntimeContext().addAccumulator(COUNTER_NAME+"_"+bnName, this.counterInstances);
}
代码示例来源:origin: amidst/toolbox
@Override
public void open(Configuration parameters) throws Exception {
super.open(parameters);
String bnName = parameters.getString(ParameterLearningAlgorithm.BN_NAME, "");
ef_bayesianNetwork = Serialization.deserializeObject(parameters.getBytes(EFBN_NAME, null));
getRuntimeContext().addAccumulator(ParallelMaximumLikelihood2.COUNTER_NAME+"_"+bnName, this.counterInstances);
}
内容来源于网络,如有侵权,请联系作者删除!