com.akaxin.proto.core.FileProto.FileType Java Examples

The following examples show how to use com.akaxin.proto.core.FileProto.FileType. 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: FileServerUtils.java    From wind-im with Apache License 2.0 5 votes vote down vote up
private static String createFileName(FileProto.FileType type, FileProto.FileDesc fileDesc) {
	String fileName = System.currentTimeMillis() + UUID.randomUUID().toString().substring(0, 8);
	if (FileProto.FileType.MESSAGE_VOICE == type) {
		// 语音
		if (fileDesc != null && fileDesc.getLength() > 0) {
			fileName = fileName + "_" + fileDesc.getLength();
		}
	} else {
		// 图片
		if (fileDesc != null && fileDesc.getWidth() > 0 && fileDesc.getHeight() > 0) {
			fileName = fileName + "_" + fileDesc.getWidth() + "_" + fileDesc.getHeight();
		}
	}
	return fileName;
}
 
Example #2
Source File: Bootstrap.java    From wind-im with Apache License 2.0 5 votes vote down vote up
private static String getDefaultIcon(String base64Str) {
	try {
		String fileBasePath = System.getProperty("user.dir");
		byte[] iconBytes = Base64.getDecoder().decode(base64Str);
		String fileId = FileServerUtils.saveFile(iconBytes, FilePathUtils.getPicPath(fileBasePath),
				FileType.SITE_PLUGIN, null);
		return fileId;
	} catch (Exception e) {
		BootLog.error(StringHelper.format("{} set openzaly-admin default icon error", WindProject.PLN), e);
	}
	return "";
}
 
Example #3
Source File: TestFile.java    From wind-im with Apache License 2.0 5 votes vote down vote up
private static String getDefaultSiteAdminIcon() {
	try {
		byte[] iconBytes = FileServerUtils.fileToBinary("Test.jpg");
		String fileId = FileServerUtils.saveFile(iconBytes, FilePathUtils.getPicPath(), FileType.GROUP_PORTRAIT,
				null);
		return fileId;
	} catch (Exception e) {
		logger.error("get default icon error", e);
	}
	return "";
}
 
Example #4
Source File: Bootstrap.java    From openzaly with Apache License 2.0 5 votes vote down vote up
private static String getDefaultIcon(String base64Str) {
	try {
		String fileBasePath = System.getProperty("user.dir");
		byte[] iconBytes = Base64.getDecoder().decode(base64Str);
		String fileId = FileServerUtils.saveFile(iconBytes, FilePathUtils.getPicPath(fileBasePath),
				FileType.SITE_PLUGIN, null);
		return fileId;
	} catch (Exception e) {
		BootLog.error(StringHelper.format("{} set openzaly-admin default icon error", AkxProject.PLN), e);
	}
	return "";
}
 
Example #5
Source File: TestFile.java    From openzaly with Apache License 2.0 5 votes vote down vote up
private static String getDefaultSiteAdminIcon() {
	try {
		byte[] iconBytes = FileServerUtils.fileToBinary("Test.jpg");
		String fileId = FileServerUtils.saveFile(iconBytes, FilePathUtils.getPicPath(), FileType.GROUP_PORTRAIT,
				null);
		return fileId;
	} catch (Exception e) {
		logger.error("get default icon error", e);
	}
	return "";
}
 
Example #6
Source File: FileServerUtils.java    From openzaly with Apache License 2.0 5 votes vote down vote up
private static String createFileName(FileProto.FileType type, FileProto.FileDesc fileDesc) {
	String fileName = System.currentTimeMillis() + UUID.randomUUID().toString().substring(0, 8);
	if (FileProto.FileType.MESSAGE_VOICE == type) {
		// 语音
		if (fileDesc != null && fileDesc.getLength() > 0) {
			fileName = fileName + "_" + fileDesc.getLength();
		}
	} else {
		// 图片
		if (fileDesc != null && fileDesc.getWidth() > 0 && fileDesc.getHeight() > 0) {
			fileName = fileName + "_" + fileDesc.getWidth() + "_" + fileDesc.getHeight();
		}
	}
	return fileName;
}
 
Example #7
Source File: Bootstrap.java    From openzaly with Apache License 2.0 5 votes vote down vote up
private static String getDefaultIcon(String base64Str) {
	try {
		String fileBasePath = System.getProperty("user.dir");
		byte[] iconBytes = Base64.getDecoder().decode(base64Str);
		String fileId = FileServerUtils.saveFile(iconBytes, FilePathUtils.getPicPath(fileBasePath),
				FileType.SITE_PLUGIN, null);
		return fileId;
	} catch (Exception e) {
		BootLog.error(StringHelper.format("{} set openzaly-admin default icon error", AkxProject.PLN), e);
	}
	return "";
}
 
Example #8
Source File: TestFile.java    From openzaly with Apache License 2.0 5 votes vote down vote up
private static String getDefaultSiteAdminIcon() {
	try {
		byte[] iconBytes = FileServerUtils.fileToBinary("Test.jpg");
		String fileId = FileServerUtils.saveFile(iconBytes, FilePathUtils.getPicPath(), FileType.GROUP_PORTRAIT,
				null);
		return fileId;
	} catch (Exception e) {
		logger.error("get default icon error", e);
	}
	return "";
}
 
Example #9
Source File: FileServerUtils.java    From openzaly with Apache License 2.0 5 votes vote down vote up
private static String createFileName(FileProto.FileType type, FileProto.FileDesc fileDesc) {
	String fileName = System.currentTimeMillis() + UUID.randomUUID().toString().substring(0, 8);
	if (FileProto.FileType.MESSAGE_VOICE == type) {
		// 语音
		if (fileDesc != null && fileDesc.getLength() > 0) {
			fileName = fileName + "_" + fileDesc.getLength();
		}
	} else {
		// 图片
		if (fileDesc != null && fileDesc.getWidth() > 0 && fileDesc.getHeight() > 0) {
			fileName = fileName + "_" + fileDesc.getWidth() + "_" + fileDesc.getHeight();
		}
	}
	return fileName;
}