Java Code Examples for org.apache.flink.util.StringUtils#byteToHexString()

The following examples show how to use org.apache.flink.util.StringUtils#byteToHexString() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BlobKey.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@Override
public String toString() {
	final String typeString;
	switch (this.type) {
		case TRANSIENT_BLOB:
			typeString = "t-";
			break;
		case PERMANENT_BLOB:
			typeString = "p-";
			break;
		default:
			// this actually never happens!
			throw new IllegalStateException("Invalid BLOB type");
	}
	return typeString + StringUtils.byteToHexString(this.key) + "-" + random.toString();
}
 
Example 2
Source File: BufferSpiller.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a new buffer spiller, spilling to one of the I/O manager's temp directories.
 *
 * @param ioManager The I/O manager for access to the temp directories.
 * @param pageSize The page size used to re-create spilled buffers.
 * @throws IOException Thrown if the temp files for spilling cannot be initialized.
 */
public BufferSpiller(IOManager ioManager, int pageSize) throws IOException {
	this.pageSize = pageSize;

	this.readBuffer = ByteBuffer.allocateDirect(READ_BUFFER_SIZE);
	this.readBuffer.order(ByteOrder.LITTLE_ENDIAN);

	this.headBuffer = ByteBuffer.allocateDirect(16);
	this.headBuffer.order(ByteOrder.LITTLE_ENDIAN);

	File[] tempDirs = ioManager.getSpillingDirectories();
	this.tempDir = tempDirs[DIRECTORY_INDEX.getAndIncrement() % tempDirs.length];

	byte[] rndBytes = new byte[32];
	ThreadLocalRandom.current().nextBytes(rndBytes);
	this.spillFilePrefix = StringUtils.byteToHexString(rndBytes) + '.';

	// prepare for first contents
	createSpillingChannel();
}
 
Example 3
Source File: BlobKey.java    From flink with Apache License 2.0 6 votes vote down vote up
@Override
public String toString() {
	final String typeString;
	switch (this.type) {
		case TRANSIENT_BLOB:
			typeString = "t-";
			break;
		case PERMANENT_BLOB:
			typeString = "p-";
			break;
		default:
			// this actually never happens!
			throw new IllegalStateException("Invalid BLOB type");
	}
	return typeString + StringUtils.byteToHexString(this.key) + "-" + random.toString();
}
 
Example 4
Source File: BufferSpiller.java    From flink with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a new {@link BufferSpiller}, spilling to one of the I/O manager's temp directories.
 *
 * @param ioManager The I/O manager for access to the temp directories.
 * @param pageSize The page size used to re-create spilled buffers.
 * @param maxBufferedBytes The maximum bytes to be buffered before the checkpoint aborts.
 * @param taskName The task name for logging.
 * @throws IOException Thrown if the temp files for spilling cannot be initialized.
 */
public BufferSpiller(IOManager ioManager, int pageSize, long maxBufferedBytes, String taskName) throws IOException {
	super(maxBufferedBytes, taskName);
	this.pageSize = pageSize;

	this.readBuffer = ByteBuffer.allocateDirect(READ_BUFFER_SIZE);
	this.readBuffer.order(ByteOrder.LITTLE_ENDIAN);

	this.headBuffer = ByteBuffer.allocateDirect(16);
	this.headBuffer.order(ByteOrder.LITTLE_ENDIAN);

	File[] tempDirs = ioManager.getSpillingDirectories();
	this.tempDir = tempDirs[DIRECTORY_INDEX.getAndIncrement() % tempDirs.length];

	byte[] rndBytes = new byte[32];
	ThreadLocalRandom.current().nextBytes(rndBytes);
	this.spillFilePrefix = StringUtils.byteToHexString(rndBytes) + '.';

	// prepare for first contents
	createSpillingChannel();
}
 
Example 5
Source File: BlobKey.java    From flink with Apache License 2.0 6 votes vote down vote up
@Override
public String toString() {
	final String typeString;
	switch (this.type) {
		case TRANSIENT_BLOB:
			typeString = "t-";
			break;
		case PERMANENT_BLOB:
			typeString = "p-";
			break;
		default:
			// this actually never happens!
			throw new IllegalStateException("Invalid BLOB type");
	}
	return typeString + StringUtils.byteToHexString(this.key) + "-" + random.toString();
}
 
Example 6
Source File: CheckpointStorageLocationReference.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@Override
public String toString() {
	return encodedReference == null ? "(default)"
			: StringUtils.byteToHexString(encodedReference, 0, encodedReference.length);
}
 
Example 7
Source File: SpillingAdaptiveSpanningRecordDeserializer.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
private static String randomString(Random random) {
	final byte[] bytes = new byte[20];
	random.nextBytes(bytes);
	return StringUtils.byteToHexString(bytes);
}
 
Example 8
Source File: FileIOChannel.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
private static String randomString(Random random) {
	byte[] bytes = new byte[RANDOM_BYTES_LENGTH];
	random.nextBytes(bytes);
	return StringUtils.byteToHexString(bytes);
}
 
Example 9
Source File: CheckpointStorageLocationReference.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public String toString() {
	return encodedReference == null ? "(default)"
			: StringUtils.byteToHexString(encodedReference, 0, encodedReference.length);
}
 
Example 10
Source File: SpillingAdaptiveSpanningRecordDeserializer.java    From flink with Apache License 2.0 4 votes vote down vote up
private static String randomString(Random random) {
	final byte[] bytes = new byte[20];
	random.nextBytes(bytes);
	return StringUtils.byteToHexString(bytes);
}
 
Example 11
Source File: FileIOChannel.java    From flink with Apache License 2.0 4 votes vote down vote up
private static String randomString(Random random) {
	byte[] bytes = new byte[RANDOM_BYTES_LENGTH];
	random.nextBytes(bytes);
	return StringUtils.byteToHexString(bytes);
}
 
Example 12
Source File: CheckpointStorageLocationReference.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public String toString() {
	return encodedReference == null ? "(default)"
			: StringUtils.byteToHexString(encodedReference, 0, encodedReference.length);
}
 
Example 13
Source File: SpanningWrapper.java    From flink with Apache License 2.0 4 votes vote down vote up
private static String randomString(Random random) {
	final byte[] bytes = new byte[20];
	random.nextBytes(bytes);
	return StringUtils.byteToHexString(bytes);
}
 
Example 14
Source File: FileIOChannel.java    From flink with Apache License 2.0 4 votes vote down vote up
private static String randomString(Random random) {
	byte[] bytes = new byte[RANDOM_BYTES_LENGTH];
	random.nextBytes(bytes);
	return StringUtils.byteToHexString(bytes);
}