Commit ee329005 authored by liuyan's avatar liuyan

fix:提交代码

parent 5b1541a6
No preview for this file type
...@@ -17,6 +17,8 @@ ...@@ -17,6 +17,8 @@
<dependencies> <dependencies>
<!-- spring-boot-devtools --> <!-- spring-boot-devtools -->
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
...@@ -30,23 +32,13 @@ ...@@ -30,23 +32,13 @@
<artifactId>springfox-boot-starter</artifactId> <artifactId>springfox-boot-starter</artifactId>
</dependency> </dependency>
<!-- 防止进入swagger页面报类型转换错误,排除3.0.0中的引用,手动增加1.6.2版本 -->
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-models</artifactId>
<version>1.6.2</version>
</dependency>
<!-- Mysql驱动包 --> <!-- Mysql驱动包 -->
<dependency> <dependency>
<groupId>mysql</groupId> <groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId> <artifactId>mysql-connector-java</artifactId>
</dependency> </dependency>
<!-- <dependency>-->
<!-- <groupId>net.devh</groupId>-->
<!-- <artifactId>grpc-spring-boot-starter</artifactId>-->
<!-- <version>2.15.0.RELEASE</version>-->
<!-- </dependency>-->
<!-- 核心模块--> <!-- 核心模块-->
<dependency> <dependency>
......
package com.ruoyi; package com.ruoyi;
import com.ruoyi.client.server.GrpcFileServer; import com.ruoyi.grpc.server.GrpcFileServer;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner; import org.springframework.boot.CommandLineRunner;
import org.springframework.core.annotation.Order; import org.springframework.core.annotation.Order;
......
...@@ -3,12 +3,14 @@ package com.ruoyi; ...@@ -3,12 +3,14 @@ package com.ruoyi;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
/** /**
* 启动程序 * 启动程序
* *
* @author ruoyi * @author ruoyi
*/ */
@EnableConfigurationProperties
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class }) @SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
public class RuoYiApplication public class RuoYiApplication
{ {
......
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: file.proto
package com.ruoyi.grpc.file;
public final class File {
private File() {}
public static void registerAllExtensions(
com.google.protobuf.ExtensionRegistryLite registry) {
}
public static void registerAllExtensions(
com.google.protobuf.ExtensionRegistry registry) {
registerAllExtensions(
(com.google.protobuf.ExtensionRegistryLite) registry);
}
static final com.google.protobuf.Descriptors.Descriptor
internal_static_FileUploadRequest_descriptor;
static final
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internal_static_FileUploadRequest_fieldAccessorTable;
static final com.google.protobuf.Descriptors.Descriptor
internal_static_FileUploadResponse_descriptor;
static final
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internal_static_FileUploadResponse_fieldAccessorTable;
static final com.google.protobuf.Descriptors.Descriptor
internal_static_FileDownloadRequest_descriptor;
static final
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internal_static_FileDownloadRequest_fieldAccessorTable;
static final com.google.protobuf.Descriptors.Descriptor
internal_static_FileDownloadResponse_descriptor;
static final
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internal_static_FileDownloadResponse_fieldAccessorTable;
public static com.google.protobuf.Descriptors.FileDescriptor
getDescriptor() {
return descriptor;
}
private static com.google.protobuf.Descriptors.FileDescriptor
descriptor;
static {
String[] descriptorData = {
"\n\nfile.proto\"@\n\021FileUploadRequest\022\022\n\010fil" +
"ename\030\001 \001(\tH\000\022\017\n\005chunk\030\002 \001(\014H\000B\006\n\004data\"2" +
"\n\022FileUploadResponse\022\016\n\006status\030\001 \001(\t\022\014\n\004" +
"size\030\002 \001(\003\"\'\n\023FileDownloadRequest\022\020\n\010fil" +
"ename\030\001 \001(\t\"%\n\024FileDownloadResponse\022\r\n\005c" +
"hunk\030\001 \001(\0142\205\001\n\013FileService\0227\n\nUploadFile" +
"\022\022.FileUploadRequest\032\023.FileUploadRespons" +
"e(\001\022=\n\014DownloadFile\022\024.FileDownloadReques" +
"t\032\025.FileDownloadResponse0\001B\035\n\023com.ruoyi." +
"grpc.fileP\001Z\004./pbb\006proto3"
};
descriptor = com.google.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,
new com.google.protobuf.Descriptors.FileDescriptor[] {
});
internal_static_FileUploadRequest_descriptor =
getDescriptor().getMessageTypes().get(0);
internal_static_FileUploadRequest_fieldAccessorTable = new
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_FileUploadRequest_descriptor,
new String[] { "Filename", "Chunk", "Data", });
internal_static_FileUploadResponse_descriptor =
getDescriptor().getMessageTypes().get(1);
internal_static_FileUploadResponse_fieldAccessorTable = new
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_FileUploadResponse_descriptor,
new String[] { "Status", "Size", });
internal_static_FileDownloadRequest_descriptor =
getDescriptor().getMessageTypes().get(2);
internal_static_FileDownloadRequest_fieldAccessorTable = new
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_FileDownloadRequest_descriptor,
new String[] { "Filename", });
internal_static_FileDownloadResponse_descriptor =
getDescriptor().getMessageTypes().get(3);
internal_static_FileDownloadResponse_fieldAccessorTable = new
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_FileDownloadResponse_descriptor,
new String[] { "Chunk", });
}
// @@protoc_insertion_point(outer_class_scope)
}
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: file.proto
package com.ruoyi.grpc.file;
/**
* Protobuf type {@code FileDownloadRequest}
*/
public final class FileDownloadRequest extends
com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:FileDownloadRequest)
FileDownloadRequestOrBuilder {
private static final long serialVersionUID = 0L;
// Use FileDownloadRequest.newBuilder() to construct.
private FileDownloadRequest(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
super(builder);
}
private FileDownloadRequest() {
filename_ = "";
}
@Override
@SuppressWarnings({"unused"})
protected Object newInstance(
UnusedPrivateParameter unused) {
return new FileDownloadRequest();
}
@Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return File.internal_static_FileDownloadRequest_descriptor;
}
@Override
protected FieldAccessorTable
internalGetFieldAccessorTable() {
return File.internal_static_FileDownloadRequest_fieldAccessorTable
.ensureFieldAccessorsInitialized(
FileDownloadRequest.class, Builder.class);
}
public static final int FILENAME_FIELD_NUMBER = 1;
@SuppressWarnings("serial")
private volatile Object filename_ = "";
/**
* <code>string filename = 1;</code>
* @return The filename.
*/
@Override
public String getFilename() {
Object ref = filename_;
if (ref instanceof String) {
return (String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
String s = bs.toStringUtf8();
filename_ = s;
return s;
}
}
/**
* <code>string filename = 1;</code>
* @return The bytes for filename.
*/
@Override
public com.google.protobuf.ByteString
getFilenameBytes() {
Object ref = filename_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(String) ref);
filename_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
private byte memoizedIsInitialized = -1;
@Override
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
memoizedIsInitialized = 1;
return true;
}
@Override
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(filename_)) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 1, filename_);
}
getUnknownFields().writeTo(output);
}
@Override
public int getSerializedSize() {
int size = memoizedSize;
if (size != -1) return size;
size = 0;
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(filename_)) {
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, filename_);
}
size += getUnknownFields().getSerializedSize();
memoizedSize = size;
return size;
}
@Override
public boolean equals(final Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof FileDownloadRequest)) {
return super.equals(obj);
}
FileDownloadRequest other = (FileDownloadRequest) obj;
if (!getFilename()
.equals(other.getFilename())) return false;
if (!getUnknownFields().equals(other.getUnknownFields())) return false;
return true;
}
@Override
public int hashCode() {
if (memoizedHashCode != 0) {
return memoizedHashCode;
}
int hash = 41;
hash = (19 * hash) + getDescriptor().hashCode();
hash = (37 * hash) + FILENAME_FIELD_NUMBER;
hash = (53 * hash) + getFilename().hashCode();
hash = (29 * hash) + getUnknownFields().hashCode();
memoizedHashCode = hash;
return hash;
}
public static FileDownloadRequest parseFrom(
java.nio.ByteBuffer data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static FileDownloadRequest parseFrom(
java.nio.ByteBuffer data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static FileDownloadRequest parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static FileDownloadRequest parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static FileDownloadRequest parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static FileDownloadRequest parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static FileDownloadRequest parseFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static FileDownloadRequest parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
public static FileDownloadRequest parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input);
}
public static FileDownloadRequest parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input, extensionRegistry);
}
public static FileDownloadRequest parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static FileDownloadRequest parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
@Override
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder() {
return DEFAULT_INSTANCE.toBuilder();
}
public static Builder newBuilder(FileDownloadRequest prototype) {
return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
}
@Override
public Builder toBuilder() {
return this == DEFAULT_INSTANCE
? new Builder() : new Builder().mergeFrom(this);
}
@Override
protected Builder newBuilderForType(
BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* Protobuf type {@code FileDownloadRequest}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
// @@protoc_insertion_point(builder_implements:FileDownloadRequest)
FileDownloadRequestOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return File.internal_static_FileDownloadRequest_descriptor;
}
@Override
protected FieldAccessorTable
internalGetFieldAccessorTable() {
return File.internal_static_FileDownloadRequest_fieldAccessorTable
.ensureFieldAccessorsInitialized(
FileDownloadRequest.class, Builder.class);
}
// Construct using com.ruoyi.grpc.file.FileDownloadRequest.newBuilder()
private Builder() {
}
private Builder(
BuilderParent parent) {
super(parent);
}
@Override
public Builder clear() {
super.clear();
bitField0_ = 0;
filename_ = "";
return this;
}
@Override
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return File.internal_static_FileDownloadRequest_descriptor;
}
@Override
public FileDownloadRequest getDefaultInstanceForType() {
return FileDownloadRequest.getDefaultInstance();
}
@Override
public FileDownloadRequest build() {
FileDownloadRequest result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
@Override
public FileDownloadRequest buildPartial() {
FileDownloadRequest result = new FileDownloadRequest(this);
if (bitField0_ != 0) { buildPartial0(result); }
onBuilt();
return result;
}
private void buildPartial0(FileDownloadRequest result) {
int from_bitField0_ = bitField0_;
if (((from_bitField0_ & 0x00000001) != 0)) {
result.filename_ = filename_;
}
}
@Override
public Builder clone() {
return super.clone();
}
@Override
public Builder setField(
com.google.protobuf.Descriptors.FieldDescriptor field,
Object value) {
return super.setField(field, value);
}
@Override
public Builder clearField(
com.google.protobuf.Descriptors.FieldDescriptor field) {
return super.clearField(field);
}
@Override
public Builder clearOneof(
com.google.protobuf.Descriptors.OneofDescriptor oneof) {
return super.clearOneof(oneof);
}
@Override
public Builder setRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
int index, Object value) {
return super.setRepeatedField(field, index, value);
}
@Override
public Builder addRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
Object value) {
return super.addRepeatedField(field, value);
}
@Override
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof FileDownloadRequest) {
return mergeFrom((FileDownloadRequest)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(FileDownloadRequest other) {
if (other == FileDownloadRequest.getDefaultInstance()) return this;
if (!other.getFilename().isEmpty()) {
filename_ = other.filename_;
bitField0_ |= 0x00000001;
onChanged();
}
this.mergeUnknownFields(other.getUnknownFields());
onChanged();
return this;
}
@Override
public final boolean isInitialized() {
return true;
}
@Override
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
if (extensionRegistry == null) {
throw new NullPointerException();
}
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
case 10: {
filename_ = input.readStringRequireUtf8();
bitField0_ |= 0x00000001;
break;
} // case 10
default: {
if (!super.parseUnknownField(input, extensionRegistry, tag)) {
done = true; // was an endgroup tag
}
break;
} // default:
} // switch (tag)
} // while (!done)
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.unwrapIOException();
} finally {
onChanged();
} // finally
return this;
}
private int bitField0_;
private Object filename_ = "";
/**
* <code>string filename = 1;</code>
* @return The filename.
*/
public String getFilename() {
Object ref = filename_;
if (!(ref instanceof String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
String s = bs.toStringUtf8();
filename_ = s;
return s;
} else {
return (String) ref;
}
}
/**
* <code>string filename = 1;</code>
* @return The bytes for filename.
*/
public com.google.protobuf.ByteString
getFilenameBytes() {
Object ref = filename_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(String) ref);
filename_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
* <code>string filename = 1;</code>
* @param value The filename to set.
* @return This builder for chaining.
*/
public Builder setFilename(
String value) {
if (value == null) { throw new NullPointerException(); }
filename_ = value;
bitField0_ |= 0x00000001;
onChanged();
return this;
}
/**
* <code>string filename = 1;</code>
* @return This builder for chaining.
*/
public Builder clearFilename() {
filename_ = getDefaultInstance().getFilename();
bitField0_ = (bitField0_ & ~0x00000001);
onChanged();
return this;
}
/**
* <code>string filename = 1;</code>
* @param value The bytes for filename to set.
* @return This builder for chaining.
*/
public Builder setFilenameBytes(
com.google.protobuf.ByteString value) {
if (value == null) { throw new NullPointerException(); }
checkByteStringIsUtf8(value);
filename_ = value;
bitField0_ |= 0x00000001;
onChanged();
return this;
}
@Override
public final Builder setUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.setUnknownFields(unknownFields);
}
@Override
public final Builder mergeUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.mergeUnknownFields(unknownFields);
}
// @@protoc_insertion_point(builder_scope:FileDownloadRequest)
}
// @@protoc_insertion_point(class_scope:FileDownloadRequest)
private static final FileDownloadRequest DEFAULT_INSTANCE;
static {
DEFAULT_INSTANCE = new FileDownloadRequest();
}
public static FileDownloadRequest getDefaultInstance() {
return DEFAULT_INSTANCE;
}
private static final com.google.protobuf.Parser<FileDownloadRequest>
PARSER = new com.google.protobuf.AbstractParser<FileDownloadRequest>() {
@Override
public FileDownloadRequest parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
Builder builder = newBuilder();
try {
builder.mergeFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(builder.buildPartial());
} catch (com.google.protobuf.UninitializedMessageException e) {
throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial());
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(e)
.setUnfinishedMessage(builder.buildPartial());
}
return builder.buildPartial();
}
};
public static com.google.protobuf.Parser<FileDownloadRequest> parser() {
return PARSER;
}
@Override
public com.google.protobuf.Parser<FileDownloadRequest> getParserForType() {
return PARSER;
}
@Override
public FileDownloadRequest getDefaultInstanceForType() {
return DEFAULT_INSTANCE;
}
}
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: file.proto
package com.ruoyi.grpc.file;
public interface FileDownloadRequestOrBuilder extends
// @@protoc_insertion_point(interface_extends:FileDownloadRequest)
com.google.protobuf.MessageOrBuilder {
/**
* <code>string filename = 1;</code>
* @return The filename.
*/
String getFilename();
/**
* <code>string filename = 1;</code>
* @return The bytes for filename.
*/
com.google.protobuf.ByteString
getFilenameBytes();
}
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: file.proto
package com.ruoyi.grpc.file;
/**
* Protobuf type {@code FileDownloadResponse}
*/
public final class FileDownloadResponse extends
com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:FileDownloadResponse)
FileDownloadResponseOrBuilder {
private static final long serialVersionUID = 0L;
// Use FileDownloadResponse.newBuilder() to construct.
private FileDownloadResponse(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
super(builder);
}
private FileDownloadResponse() {
chunk_ = com.google.protobuf.ByteString.EMPTY;
}
@Override
@SuppressWarnings({"unused"})
protected Object newInstance(
UnusedPrivateParameter unused) {
return new FileDownloadResponse();
}
@Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return File.internal_static_FileDownloadResponse_descriptor;
}
@Override
protected FieldAccessorTable
internalGetFieldAccessorTable() {
return File.internal_static_FileDownloadResponse_fieldAccessorTable
.ensureFieldAccessorsInitialized(
FileDownloadResponse.class, Builder.class);
}
public static final int CHUNK_FIELD_NUMBER = 1;
private com.google.protobuf.ByteString chunk_ = com.google.protobuf.ByteString.EMPTY;
/**
* <code>bytes chunk = 1;</code>
* @return The chunk.
*/
@Override
public com.google.protobuf.ByteString getChunk() {
return chunk_;
}
private byte memoizedIsInitialized = -1;
@Override
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
memoizedIsInitialized = 1;
return true;
}
@Override
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
if (!chunk_.isEmpty()) {
output.writeBytes(1, chunk_);
}
getUnknownFields().writeTo(output);
}
@Override
public int getSerializedSize() {
int size = memoizedSize;
if (size != -1) return size;
size = 0;
if (!chunk_.isEmpty()) {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(1, chunk_);
}
size += getUnknownFields().getSerializedSize();
memoizedSize = size;
return size;
}
@Override
public boolean equals(final Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof FileDownloadResponse)) {
return super.equals(obj);
}
FileDownloadResponse other = (FileDownloadResponse) obj;
if (!getChunk()
.equals(other.getChunk())) return false;
if (!getUnknownFields().equals(other.getUnknownFields())) return false;
return true;
}
@Override
public int hashCode() {
if (memoizedHashCode != 0) {
return memoizedHashCode;
}
int hash = 41;
hash = (19 * hash) + getDescriptor().hashCode();
hash = (37 * hash) + CHUNK_FIELD_NUMBER;
hash = (53 * hash) + getChunk().hashCode();
hash = (29 * hash) + getUnknownFields().hashCode();
memoizedHashCode = hash;
return hash;
}
public static FileDownloadResponse parseFrom(
java.nio.ByteBuffer data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static FileDownloadResponse parseFrom(
java.nio.ByteBuffer data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static FileDownloadResponse parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static FileDownloadResponse parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static FileDownloadResponse parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static FileDownloadResponse parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static FileDownloadResponse parseFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static FileDownloadResponse parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
public static FileDownloadResponse parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input);
}
public static FileDownloadResponse parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input, extensionRegistry);
}
public static FileDownloadResponse parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static FileDownloadResponse parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
@Override
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder() {
return DEFAULT_INSTANCE.toBuilder();
}
public static Builder newBuilder(FileDownloadResponse prototype) {
return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
}
@Override
public Builder toBuilder() {
return this == DEFAULT_INSTANCE
? new Builder() : new Builder().mergeFrom(this);
}
@Override
protected Builder newBuilderForType(
BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* Protobuf type {@code FileDownloadResponse}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
// @@protoc_insertion_point(builder_implements:FileDownloadResponse)
FileDownloadResponseOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return File.internal_static_FileDownloadResponse_descriptor;
}
@Override
protected FieldAccessorTable
internalGetFieldAccessorTable() {
return File.internal_static_FileDownloadResponse_fieldAccessorTable
.ensureFieldAccessorsInitialized(
FileDownloadResponse.class, Builder.class);
}
// Construct using com.ruoyi.grpc.file.FileDownloadResponse.newBuilder()
private Builder() {
}
private Builder(
BuilderParent parent) {
super(parent);
}
@Override
public Builder clear() {
super.clear();
bitField0_ = 0;
chunk_ = com.google.protobuf.ByteString.EMPTY;
return this;
}
@Override
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return File.internal_static_FileDownloadResponse_descriptor;
}
@Override
public FileDownloadResponse getDefaultInstanceForType() {
return FileDownloadResponse.getDefaultInstance();
}
@Override
public FileDownloadResponse build() {
FileDownloadResponse result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
@Override
public FileDownloadResponse buildPartial() {
FileDownloadResponse result = new FileDownloadResponse(this);
if (bitField0_ != 0) { buildPartial0(result); }
onBuilt();
return result;
}
private void buildPartial0(FileDownloadResponse result) {
int from_bitField0_ = bitField0_;
if (((from_bitField0_ & 0x00000001) != 0)) {
result.chunk_ = chunk_;
}
}
@Override
public Builder clone() {
return super.clone();
}
@Override
public Builder setField(
com.google.protobuf.Descriptors.FieldDescriptor field,
Object value) {
return super.setField(field, value);
}
@Override
public Builder clearField(
com.google.protobuf.Descriptors.FieldDescriptor field) {
return super.clearField(field);
}
@Override
public Builder clearOneof(
com.google.protobuf.Descriptors.OneofDescriptor oneof) {
return super.clearOneof(oneof);
}
@Override
public Builder setRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
int index, Object value) {
return super.setRepeatedField(field, index, value);
}
@Override
public Builder addRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
Object value) {
return super.addRepeatedField(field, value);
}
@Override
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof FileDownloadResponse) {
return mergeFrom((FileDownloadResponse)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(FileDownloadResponse other) {
if (other == FileDownloadResponse.getDefaultInstance()) return this;
if (other.getChunk() != com.google.protobuf.ByteString.EMPTY) {
setChunk(other.getChunk());
}
this.mergeUnknownFields(other.getUnknownFields());
onChanged();
return this;
}
@Override
public final boolean isInitialized() {
return true;
}
@Override
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
if (extensionRegistry == null) {
throw new NullPointerException();
}
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
case 10: {
chunk_ = input.readBytes();
bitField0_ |= 0x00000001;
break;
} // case 10
default: {
if (!super.parseUnknownField(input, extensionRegistry, tag)) {
done = true; // was an endgroup tag
}
break;
} // default:
} // switch (tag)
} // while (!done)
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.unwrapIOException();
} finally {
onChanged();
} // finally
return this;
}
private int bitField0_;
private com.google.protobuf.ByteString chunk_ = com.google.protobuf.ByteString.EMPTY;
/**
* <code>bytes chunk = 1;</code>
* @return The chunk.
*/
@Override
public com.google.protobuf.ByteString getChunk() {
return chunk_;
}
/**
* <code>bytes chunk = 1;</code>
* @param value The chunk to set.
* @return This builder for chaining.
*/
public Builder setChunk(com.google.protobuf.ByteString value) {
if (value == null) { throw new NullPointerException(); }
chunk_ = value;
bitField0_ |= 0x00000001;
onChanged();
return this;
}
/**
* <code>bytes chunk = 1;</code>
* @return This builder for chaining.
*/
public Builder clearChunk() {
bitField0_ = (bitField0_ & ~0x00000001);
chunk_ = getDefaultInstance().getChunk();
onChanged();
return this;
}
@Override
public final Builder setUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.setUnknownFields(unknownFields);
}
@Override
public final Builder mergeUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.mergeUnknownFields(unknownFields);
}
// @@protoc_insertion_point(builder_scope:FileDownloadResponse)
}
// @@protoc_insertion_point(class_scope:FileDownloadResponse)
private static final FileDownloadResponse DEFAULT_INSTANCE;
static {
DEFAULT_INSTANCE = new FileDownloadResponse();
}
public static FileDownloadResponse getDefaultInstance() {
return DEFAULT_INSTANCE;
}
private static final com.google.protobuf.Parser<FileDownloadResponse>
PARSER = new com.google.protobuf.AbstractParser<FileDownloadResponse>() {
@Override
public FileDownloadResponse parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
Builder builder = newBuilder();
try {
builder.mergeFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(builder.buildPartial());
} catch (com.google.protobuf.UninitializedMessageException e) {
throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial());
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(e)
.setUnfinishedMessage(builder.buildPartial());
}
return builder.buildPartial();
}
};
public static com.google.protobuf.Parser<FileDownloadResponse> parser() {
return PARSER;
}
@Override
public com.google.protobuf.Parser<FileDownloadResponse> getParserForType() {
return PARSER;
}
@Override
public FileDownloadResponse getDefaultInstanceForType() {
return DEFAULT_INSTANCE;
}
}
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: file.proto
package com.ruoyi.grpc.file;
public interface FileDownloadResponseOrBuilder extends
// @@protoc_insertion_point(interface_extends:FileDownloadResponse)
com.google.protobuf.MessageOrBuilder {
/**
* <code>bytes chunk = 1;</code>
* @return The chunk.
*/
com.google.protobuf.ByteString getChunk();
}
package com.ruoyi.grpc.file;
import static io.grpc.MethodDescriptor.generateFullMethodName;
/**
*/
@javax.annotation.Generated(
value = "by gRPC proto compiler (version 1.56.1)",
comments = "Source: file.proto")
@io.grpc.stub.annotations.GrpcGenerated
public final class FileServiceGrpc {
private FileServiceGrpc() {}
public static final String SERVICE_NAME = "FileService";
// Static method descriptors that strictly reflect the proto.
private static volatile io.grpc.MethodDescriptor<FileUploadRequest,
FileUploadResponse> getUploadFileMethod;
@io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "UploadFile",
requestType = FileUploadRequest.class,
responseType = FileUploadResponse.class,
methodType = io.grpc.MethodDescriptor.MethodType.CLIENT_STREAMING)
public static io.grpc.MethodDescriptor<FileUploadRequest,
FileUploadResponse> getUploadFileMethod() {
io.grpc.MethodDescriptor<FileUploadRequest, FileUploadResponse> getUploadFileMethod;
if ((getUploadFileMethod = FileServiceGrpc.getUploadFileMethod) == null) {
synchronized (FileServiceGrpc.class) {
if ((getUploadFileMethod = FileServiceGrpc.getUploadFileMethod) == null) {
FileServiceGrpc.getUploadFileMethod = getUploadFileMethod =
io.grpc.MethodDescriptor.<FileUploadRequest, FileUploadResponse>newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.CLIENT_STREAMING)
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "UploadFile"))
.setSampledToLocalTracing(true)
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
FileUploadRequest.getDefaultInstance()))
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
FileUploadResponse.getDefaultInstance()))
.setSchemaDescriptor(new FileServiceMethodDescriptorSupplier("UploadFile"))
.build();
}
}
}
return getUploadFileMethod;
}
private static volatile io.grpc.MethodDescriptor<FileDownloadRequest,
FileDownloadResponse> getDownloadFileMethod;
@io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "DownloadFile",
requestType = FileDownloadRequest.class,
responseType = FileDownloadResponse.class,
methodType = io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING)
public static io.grpc.MethodDescriptor<FileDownloadRequest,
FileDownloadResponse> getDownloadFileMethod() {
io.grpc.MethodDescriptor<FileDownloadRequest, FileDownloadResponse> getDownloadFileMethod;
if ((getDownloadFileMethod = FileServiceGrpc.getDownloadFileMethod) == null) {
synchronized (FileServiceGrpc.class) {
if ((getDownloadFileMethod = FileServiceGrpc.getDownloadFileMethod) == null) {
FileServiceGrpc.getDownloadFileMethod = getDownloadFileMethod =
io.grpc.MethodDescriptor.<FileDownloadRequest, FileDownloadResponse>newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING)
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "DownloadFile"))
.setSampledToLocalTracing(true)
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
FileDownloadRequest.getDefaultInstance()))
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
FileDownloadResponse.getDefaultInstance()))
.setSchemaDescriptor(new FileServiceMethodDescriptorSupplier("DownloadFile"))
.build();
}
}
}
return getDownloadFileMethod;
}
/**
* Creates a new async stub that supports all call types for the service
*/
public static FileServiceStub newStub(io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory<FileServiceStub> factory =
new io.grpc.stub.AbstractStub.StubFactory<FileServiceStub>() {
@Override
public FileServiceStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new FileServiceStub(channel, callOptions);
}
};
return FileServiceStub.newStub(factory, channel);
}
/**
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
*/
public static FileServiceBlockingStub newBlockingStub(
io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory<FileServiceBlockingStub> factory =
new io.grpc.stub.AbstractStub.StubFactory<FileServiceBlockingStub>() {
@Override
public FileServiceBlockingStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new FileServiceBlockingStub(channel, callOptions);
}
};
return FileServiceBlockingStub.newStub(factory, channel);
}
/**
* Creates a new ListenableFuture-style stub that supports unary calls on the service
*/
public static FileServiceFutureStub newFutureStub(
io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory<FileServiceFutureStub> factory =
new io.grpc.stub.AbstractStub.StubFactory<FileServiceFutureStub>() {
@Override
public FileServiceFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new FileServiceFutureStub(channel, callOptions);
}
};
return FileServiceFutureStub.newStub(factory, channel);
}
/**
*/
public interface AsyncService {
/**
*/
default io.grpc.stub.StreamObserver<FileUploadRequest> uploadFile(
io.grpc.stub.StreamObserver<FileUploadResponse> responseObserver) {
return io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall(getUploadFileMethod(), responseObserver);
}
/**
*/
default void downloadFile(FileDownloadRequest request,
io.grpc.stub.StreamObserver<FileDownloadResponse> responseObserver) {
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getDownloadFileMethod(), responseObserver);
}
}
/**
* Base class for the server implementation of the service FileService.
*/
public static abstract class FileServiceImplBase
implements io.grpc.BindableService, AsyncService {
@Override public final io.grpc.ServerServiceDefinition bindService() {
return FileServiceGrpc.bindService(this);
}
}
/**
* A stub to allow clients to do asynchronous rpc calls to service FileService.
*/
public static final class FileServiceStub
extends io.grpc.stub.AbstractAsyncStub<FileServiceStub> {
private FileServiceStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
@Override
protected FileServiceStub build(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new FileServiceStub(channel, callOptions);
}
/**
*/
public io.grpc.stub.StreamObserver<FileUploadRequest> uploadFile(
io.grpc.stub.StreamObserver<FileUploadResponse> responseObserver) {
return io.grpc.stub.ClientCalls.asyncClientStreamingCall(
getChannel().newCall(getUploadFileMethod(), getCallOptions()), responseObserver);
}
/**
*/
public void downloadFile(FileDownloadRequest request,
io.grpc.stub.StreamObserver<FileDownloadResponse> responseObserver) {
io.grpc.stub.ClientCalls.asyncServerStreamingCall(
getChannel().newCall(getDownloadFileMethod(), getCallOptions()), request, responseObserver);
}
}
/**
* A stub to allow clients to do synchronous rpc calls to service FileService.
*/
public static final class FileServiceBlockingStub
extends io.grpc.stub.AbstractBlockingStub<FileServiceBlockingStub> {
private FileServiceBlockingStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
@Override
protected FileServiceBlockingStub build(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new FileServiceBlockingStub(channel, callOptions);
}
/**
*/
public java.util.Iterator<FileDownloadResponse> downloadFile(
FileDownloadRequest request) {
return io.grpc.stub.ClientCalls.blockingServerStreamingCall(
getChannel(), getDownloadFileMethod(), getCallOptions(), request);
}
}
/**
* A stub to allow clients to do ListenableFuture-style rpc calls to service FileService.
*/
public static final class FileServiceFutureStub
extends io.grpc.stub.AbstractFutureStub<FileServiceFutureStub> {
private FileServiceFutureStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
@Override
protected FileServiceFutureStub build(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new FileServiceFutureStub(channel, callOptions);
}
}
private static final int METHODID_DOWNLOAD_FILE = 0;
private static final int METHODID_UPLOAD_FILE = 1;
private static final class MethodHandlers<Req, Resp> implements
io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
private final AsyncService serviceImpl;
private final int methodId;
MethodHandlers(AsyncService serviceImpl, int methodId) {
this.serviceImpl = serviceImpl;
this.methodId = methodId;
}
@Override
@SuppressWarnings("unchecked")
public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
switch (methodId) {
case METHODID_DOWNLOAD_FILE:
serviceImpl.downloadFile((FileDownloadRequest) request,
(io.grpc.stub.StreamObserver<FileDownloadResponse>) responseObserver);
break;
default:
throw new AssertionError();
}
}
@Override
@SuppressWarnings("unchecked")
public io.grpc.stub.StreamObserver<Req> invoke(
io.grpc.stub.StreamObserver<Resp> responseObserver) {
switch (methodId) {
case METHODID_UPLOAD_FILE:
return (io.grpc.stub.StreamObserver<Req>) serviceImpl.uploadFile(
(io.grpc.stub.StreamObserver<FileUploadResponse>) responseObserver);
default:
throw new AssertionError();
}
}
}
public static final io.grpc.ServerServiceDefinition bindService(AsyncService service) {
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
.addMethod(
getUploadFileMethod(),
io.grpc.stub.ServerCalls.asyncClientStreamingCall(
new MethodHandlers<
FileUploadRequest,
FileUploadResponse>(
service, METHODID_UPLOAD_FILE)))
.addMethod(
getDownloadFileMethod(),
io.grpc.stub.ServerCalls.asyncServerStreamingCall(
new MethodHandlers<
FileDownloadRequest,
FileDownloadResponse>(
service, METHODID_DOWNLOAD_FILE)))
.build();
}
private static abstract class FileServiceBaseDescriptorSupplier
implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier {
FileServiceBaseDescriptorSupplier() {}
@Override
public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() {
return File.getDescriptor();
}
@Override
public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() {
return getFileDescriptor().findServiceByName("FileService");
}
}
private static final class FileServiceFileDescriptorSupplier
extends FileServiceBaseDescriptorSupplier {
FileServiceFileDescriptorSupplier() {}
}
private static final class FileServiceMethodDescriptorSupplier
extends FileServiceBaseDescriptorSupplier
implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
private final String methodName;
FileServiceMethodDescriptorSupplier(String methodName) {
this.methodName = methodName;
}
@Override
public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() {
return getServiceDescriptor().findMethodByName(methodName);
}
}
private static volatile io.grpc.ServiceDescriptor serviceDescriptor;
public static io.grpc.ServiceDescriptor getServiceDescriptor() {
io.grpc.ServiceDescriptor result = serviceDescriptor;
if (result == null) {
synchronized (FileServiceGrpc.class) {
result = serviceDescriptor;
if (result == null) {
serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
.setSchemaDescriptor(new FileServiceFileDescriptorSupplier())
.addMethod(getUploadFileMethod())
.addMethod(getDownloadFileMethod())
.build();
}
}
}
return result;
}
}
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: file.proto
package com.ruoyi.grpc.file;
/**
* Protobuf type {@code FileUploadRequest}
*/
public final class FileUploadRequest extends
com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:FileUploadRequest)
FileUploadRequestOrBuilder {
private static final long serialVersionUID = 0L;
// Use FileUploadRequest.newBuilder() to construct.
private FileUploadRequest(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
super(builder);
}
private FileUploadRequest() {
}
@Override
@SuppressWarnings({"unused"})
protected Object newInstance(
UnusedPrivateParameter unused) {
return new FileUploadRequest();
}
@Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return File.internal_static_FileUploadRequest_descriptor;
}
@Override
protected FieldAccessorTable
internalGetFieldAccessorTable() {
return File.internal_static_FileUploadRequest_fieldAccessorTable
.ensureFieldAccessorsInitialized(
FileUploadRequest.class, Builder.class);
}
private int dataCase_ = 0;
private Object data_;
public enum DataCase
implements com.google.protobuf.Internal.EnumLite,
InternalOneOfEnum {
FILENAME(1),
CHUNK(2),
DATA_NOT_SET(0);
private final int value;
private DataCase(int value) {
this.value = value;
}
/**
* @param value The number of the enum to look for.
* @return The enum associated with the given number.
* @deprecated Use {@link #forNumber(int)} instead.
*/
@Deprecated
public static DataCase valueOf(int value) {
return forNumber(value);
}
public static DataCase forNumber(int value) {
switch (value) {
case 1: return FILENAME;
case 2: return CHUNK;
case 0: return DATA_NOT_SET;
default: return null;
}
}
public int getNumber() {
return this.value;
}
};
public DataCase
getDataCase() {
return DataCase.forNumber(
dataCase_);
}
public static final int FILENAME_FIELD_NUMBER = 1;
/**
* <code>string filename = 1;</code>
* @return Whether the filename field is set.
*/
public boolean hasFilename() {
return dataCase_ == 1;
}
/**
* <code>string filename = 1;</code>
* @return The filename.
*/
public String getFilename() {
Object ref = "";
if (dataCase_ == 1) {
ref = data_;
}
if (ref instanceof String) {
return (String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
String s = bs.toStringUtf8();
if (dataCase_ == 1) {
data_ = s;
}
return s;
}
}
/**
* <code>string filename = 1;</code>
* @return The bytes for filename.
*/
public com.google.protobuf.ByteString
getFilenameBytes() {
Object ref = "";
if (dataCase_ == 1) {
ref = data_;
}
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(String) ref);
if (dataCase_ == 1) {
data_ = b;
}
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
public static final int CHUNK_FIELD_NUMBER = 2;
/**
* <code>bytes chunk = 2;</code>
* @return Whether the chunk field is set.
*/
@Override
public boolean hasChunk() {
return dataCase_ == 2;
}
/**
* <code>bytes chunk = 2;</code>
* @return The chunk.
*/
@Override
public com.google.protobuf.ByteString getChunk() {
if (dataCase_ == 2) {
return (com.google.protobuf.ByteString) data_;
}
return com.google.protobuf.ByteString.EMPTY;
}
private byte memoizedIsInitialized = -1;
@Override
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
memoizedIsInitialized = 1;
return true;
}
@Override
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
if (dataCase_ == 1) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 1, data_);
}
if (dataCase_ == 2) {
output.writeBytes(
2, (com.google.protobuf.ByteString) data_);
}
getUnknownFields().writeTo(output);
}
@Override
public int getSerializedSize() {
int size = memoizedSize;
if (size != -1) return size;
size = 0;
if (dataCase_ == 1) {
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, data_);
}
if (dataCase_ == 2) {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(
2, (com.google.protobuf.ByteString) data_);
}
size += getUnknownFields().getSerializedSize();
memoizedSize = size;
return size;
}
@Override
public boolean equals(final Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof FileUploadRequest)) {
return super.equals(obj);
}
FileUploadRequest other = (FileUploadRequest) obj;
if (!getDataCase().equals(other.getDataCase())) return false;
switch (dataCase_) {
case 1:
if (!getFilename()
.equals(other.getFilename())) return false;
break;
case 2:
if (!getChunk()
.equals(other.getChunk())) return false;
break;
case 0:
default:
}
if (!getUnknownFields().equals(other.getUnknownFields())) return false;
return true;
}
@Override
public int hashCode() {
if (memoizedHashCode != 0) {
return memoizedHashCode;
}
int hash = 41;
hash = (19 * hash) + getDescriptor().hashCode();
switch (dataCase_) {
case 1:
hash = (37 * hash) + FILENAME_FIELD_NUMBER;
hash = (53 * hash) + getFilename().hashCode();
break;
case 2:
hash = (37 * hash) + CHUNK_FIELD_NUMBER;
hash = (53 * hash) + getChunk().hashCode();
break;
case 0:
default:
}
hash = (29 * hash) + getUnknownFields().hashCode();
memoizedHashCode = hash;
return hash;
}
public static FileUploadRequest parseFrom(
java.nio.ByteBuffer data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static FileUploadRequest parseFrom(
java.nio.ByteBuffer data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static FileUploadRequest parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static FileUploadRequest parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static FileUploadRequest parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static FileUploadRequest parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static FileUploadRequest parseFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static FileUploadRequest parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
public static FileUploadRequest parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input);
}
public static FileUploadRequest parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input, extensionRegistry);
}
public static FileUploadRequest parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static FileUploadRequest parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
@Override
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder() {
return DEFAULT_INSTANCE.toBuilder();
}
public static Builder newBuilder(FileUploadRequest prototype) {
return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
}
@Override
public Builder toBuilder() {
return this == DEFAULT_INSTANCE
? new Builder() : new Builder().mergeFrom(this);
}
@Override
protected Builder newBuilderForType(
BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* Protobuf type {@code FileUploadRequest}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
// @@protoc_insertion_point(builder_implements:FileUploadRequest)
FileUploadRequestOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return File.internal_static_FileUploadRequest_descriptor;
}
@Override
protected FieldAccessorTable
internalGetFieldAccessorTable() {
return File.internal_static_FileUploadRequest_fieldAccessorTable
.ensureFieldAccessorsInitialized(
FileUploadRequest.class, Builder.class);
}
// Construct using com.ruoyi.grpc.file.FileUploadRequest.newBuilder()
private Builder() {
}
private Builder(
BuilderParent parent) {
super(parent);
}
@Override
public Builder clear() {
super.clear();
bitField0_ = 0;
dataCase_ = 0;
data_ = null;
return this;
}
@Override
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return File.internal_static_FileUploadRequest_descriptor;
}
@Override
public FileUploadRequest getDefaultInstanceForType() {
return FileUploadRequest.getDefaultInstance();
}
@Override
public FileUploadRequest build() {
FileUploadRequest result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
@Override
public FileUploadRequest buildPartial() {
FileUploadRequest result = new FileUploadRequest(this);
if (bitField0_ != 0) { buildPartial0(result); }
buildPartialOneofs(result);
onBuilt();
return result;
}
private void buildPartial0(FileUploadRequest result) {
int from_bitField0_ = bitField0_;
}
private void buildPartialOneofs(FileUploadRequest result) {
result.dataCase_ = dataCase_;
result.data_ = this.data_;
}
@Override
public Builder clone() {
return super.clone();
}
@Override
public Builder setField(
com.google.protobuf.Descriptors.FieldDescriptor field,
Object value) {
return super.setField(field, value);
}
@Override
public Builder clearField(
com.google.protobuf.Descriptors.FieldDescriptor field) {
return super.clearField(field);
}
@Override
public Builder clearOneof(
com.google.protobuf.Descriptors.OneofDescriptor oneof) {
return super.clearOneof(oneof);
}
@Override
public Builder setRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
int index, Object value) {
return super.setRepeatedField(field, index, value);
}
@Override
public Builder addRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
Object value) {
return super.addRepeatedField(field, value);
}
@Override
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof FileUploadRequest) {
return mergeFrom((FileUploadRequest)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(FileUploadRequest other) {
if (other == FileUploadRequest.getDefaultInstance()) return this;
switch (other.getDataCase()) {
case FILENAME: {
dataCase_ = 1;
data_ = other.data_;
onChanged();
break;
}
case CHUNK: {
setChunk(other.getChunk());
break;
}
case DATA_NOT_SET: {
break;
}
}
this.mergeUnknownFields(other.getUnknownFields());
onChanged();
return this;
}
@Override
public final boolean isInitialized() {
return true;
}
@Override
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
if (extensionRegistry == null) {
throw new NullPointerException();
}
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
case 10: {
String s = input.readStringRequireUtf8();
dataCase_ = 1;
data_ = s;
break;
} // case 10
case 18: {
data_ = input.readBytes();
dataCase_ = 2;
break;
} // case 18
default: {
if (!super.parseUnknownField(input, extensionRegistry, tag)) {
done = true; // was an endgroup tag
}
break;
} // default:
} // switch (tag)
} // while (!done)
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.unwrapIOException();
} finally {
onChanged();
} // finally
return this;
}
private int dataCase_ = 0;
private Object data_;
public DataCase
getDataCase() {
return DataCase.forNumber(
dataCase_);
}
public Builder clearData() {
dataCase_ = 0;
data_ = null;
onChanged();
return this;
}
private int bitField0_;
/**
* <code>string filename = 1;</code>
* @return Whether the filename field is set.
*/
@Override
public boolean hasFilename() {
return dataCase_ == 1;
}
/**
* <code>string filename = 1;</code>
* @return The filename.
*/
@Override
public String getFilename() {
Object ref = "";
if (dataCase_ == 1) {
ref = data_;
}
if (!(ref instanceof String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
String s = bs.toStringUtf8();
if (dataCase_ == 1) {
data_ = s;
}
return s;
} else {
return (String) ref;
}
}
/**
* <code>string filename = 1;</code>
* @return The bytes for filename.
*/
@Override
public com.google.protobuf.ByteString
getFilenameBytes() {
Object ref = "";
if (dataCase_ == 1) {
ref = data_;
}
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(String) ref);
if (dataCase_ == 1) {
data_ = b;
}
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
* <code>string filename = 1;</code>
* @param value The filename to set.
* @return This builder for chaining.
*/
public Builder setFilename(
String value) {
if (value == null) { throw new NullPointerException(); }
dataCase_ = 1;
data_ = value;
onChanged();
return this;
}
/**
* <code>string filename = 1;</code>
* @return This builder for chaining.
*/
public Builder clearFilename() {
if (dataCase_ == 1) {
dataCase_ = 0;
data_ = null;
onChanged();
}
return this;
}
/**
* <code>string filename = 1;</code>
* @param value The bytes for filename to set.
* @return This builder for chaining.
*/
public Builder setFilenameBytes(
com.google.protobuf.ByteString value) {
if (value == null) { throw new NullPointerException(); }
checkByteStringIsUtf8(value);
dataCase_ = 1;
data_ = value;
onChanged();
return this;
}
/**
* <code>bytes chunk = 2;</code>
* @return Whether the chunk field is set.
*/
public boolean hasChunk() {
return dataCase_ == 2;
}
/**
* <code>bytes chunk = 2;</code>
* @return The chunk.
*/
public com.google.protobuf.ByteString getChunk() {
if (dataCase_ == 2) {
return (com.google.protobuf.ByteString) data_;
}
return com.google.protobuf.ByteString.EMPTY;
}
/**
* <code>bytes chunk = 2;</code>
* @param value The chunk to set.
* @return This builder for chaining.
*/
public Builder setChunk(com.google.protobuf.ByteString value) {
if (value == null) { throw new NullPointerException(); }
dataCase_ = 2;
data_ = value;
onChanged();
return this;
}
/**
* <code>bytes chunk = 2;</code>
* @return This builder for chaining.
*/
public Builder clearChunk() {
if (dataCase_ == 2) {
dataCase_ = 0;
data_ = null;
onChanged();
}
return this;
}
@Override
public final Builder setUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.setUnknownFields(unknownFields);
}
@Override
public final Builder mergeUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.mergeUnknownFields(unknownFields);
}
// @@protoc_insertion_point(builder_scope:FileUploadRequest)
}
// @@protoc_insertion_point(class_scope:FileUploadRequest)
private static final FileUploadRequest DEFAULT_INSTANCE;
static {
DEFAULT_INSTANCE = new FileUploadRequest();
}
public static FileUploadRequest getDefaultInstance() {
return DEFAULT_INSTANCE;
}
private static final com.google.protobuf.Parser<FileUploadRequest>
PARSER = new com.google.protobuf.AbstractParser<FileUploadRequest>() {
@Override
public FileUploadRequest parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
Builder builder = newBuilder();
try {
builder.mergeFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(builder.buildPartial());
} catch (com.google.protobuf.UninitializedMessageException e) {
throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial());
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(e)
.setUnfinishedMessage(builder.buildPartial());
}
return builder.buildPartial();
}
};
public static com.google.protobuf.Parser<FileUploadRequest> parser() {
return PARSER;
}
@Override
public com.google.protobuf.Parser<FileUploadRequest> getParserForType() {
return PARSER;
}
@Override
public FileUploadRequest getDefaultInstanceForType() {
return DEFAULT_INSTANCE;
}
}
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: file.proto
package com.ruoyi.grpc.file;
public interface FileUploadRequestOrBuilder extends
// @@protoc_insertion_point(interface_extends:FileUploadRequest)
com.google.protobuf.MessageOrBuilder {
/**
* <code>string filename = 1;</code>
* @return Whether the filename field is set.
*/
boolean hasFilename();
/**
* <code>string filename = 1;</code>
* @return The filename.
*/
String getFilename();
/**
* <code>string filename = 1;</code>
* @return The bytes for filename.
*/
com.google.protobuf.ByteString
getFilenameBytes();
/**
* <code>bytes chunk = 2;</code>
* @return Whether the chunk field is set.
*/
boolean hasChunk();
/**
* <code>bytes chunk = 2;</code>
* @return The chunk.
*/
com.google.protobuf.ByteString getChunk();
public FileUploadRequest.DataCase getDataCase();
}
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: file.proto
package com.ruoyi.grpc.file;
/**
* Protobuf type {@code FileUploadResponse}
*/
public final class FileUploadResponse extends
com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:FileUploadResponse)
FileUploadResponseOrBuilder {
private static final long serialVersionUID = 0L;
// Use FileUploadResponse.newBuilder() to construct.
private FileUploadResponse(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
super(builder);
}
private FileUploadResponse() {
status_ = "";
}
@Override
@SuppressWarnings({"unused"})
protected Object newInstance(
UnusedPrivateParameter unused) {
return new FileUploadResponse();
}
@Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return File.internal_static_FileUploadResponse_descriptor;
}
@Override
protected FieldAccessorTable
internalGetFieldAccessorTable() {
return File.internal_static_FileUploadResponse_fieldAccessorTable
.ensureFieldAccessorsInitialized(
FileUploadResponse.class, Builder.class);
}
public static final int STATUS_FIELD_NUMBER = 1;
@SuppressWarnings("serial")
private volatile Object status_ = "";
/**
* <code>string status = 1;</code>
* @return The status.
*/
@Override
public String getStatus() {
Object ref = status_;
if (ref instanceof String) {
return (String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
String s = bs.toStringUtf8();
status_ = s;
return s;
}
}
/**
* <code>string status = 1;</code>
* @return The bytes for status.
*/
@Override
public com.google.protobuf.ByteString
getStatusBytes() {
Object ref = status_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(String) ref);
status_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
public static final int SIZE_FIELD_NUMBER = 2;
private long size_ = 0L;
/**
* <code>int64 size = 2;</code>
* @return The size.
*/
@Override
public long getSize() {
return size_;
}
private byte memoizedIsInitialized = -1;
@Override
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
memoizedIsInitialized = 1;
return true;
}
@Override
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(status_)) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 1, status_);
}
if (size_ != 0L) {
output.writeInt64(2, size_);
}
getUnknownFields().writeTo(output);
}
@Override
public int getSerializedSize() {
int size = memoizedSize;
if (size != -1) return size;
size = 0;
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(status_)) {
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, status_);
}
if (size_ != 0L) {
size += com.google.protobuf.CodedOutputStream
.computeInt64Size(2, size_);
}
size += getUnknownFields().getSerializedSize();
memoizedSize = size;
return size;
}
@Override
public boolean equals(final Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof FileUploadResponse)) {
return super.equals(obj);
}
FileUploadResponse other = (FileUploadResponse) obj;
if (!getStatus()
.equals(other.getStatus())) return false;
if (getSize()
!= other.getSize()) return false;
if (!getUnknownFields().equals(other.getUnknownFields())) return false;
return true;
}
@Override
public int hashCode() {
if (memoizedHashCode != 0) {
return memoizedHashCode;
}
int hash = 41;
hash = (19 * hash) + getDescriptor().hashCode();
hash = (37 * hash) + STATUS_FIELD_NUMBER;
hash = (53 * hash) + getStatus().hashCode();
hash = (37 * hash) + SIZE_FIELD_NUMBER;
hash = (53 * hash) + com.google.protobuf.Internal.hashLong(
getSize());
hash = (29 * hash) + getUnknownFields().hashCode();
memoizedHashCode = hash;
return hash;
}
public static FileUploadResponse parseFrom(
java.nio.ByteBuffer data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static FileUploadResponse parseFrom(
java.nio.ByteBuffer data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static FileUploadResponse parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static FileUploadResponse parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static FileUploadResponse parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static FileUploadResponse parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static FileUploadResponse parseFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static FileUploadResponse parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
public static FileUploadResponse parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input);
}
public static FileUploadResponse parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input, extensionRegistry);
}
public static FileUploadResponse parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static FileUploadResponse parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
@Override
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder() {
return DEFAULT_INSTANCE.toBuilder();
}
public static Builder newBuilder(FileUploadResponse prototype) {
return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
}
@Override
public Builder toBuilder() {
return this == DEFAULT_INSTANCE
? new Builder() : new Builder().mergeFrom(this);
}
@Override
protected Builder newBuilderForType(
BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* Protobuf type {@code FileUploadResponse}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
// @@protoc_insertion_point(builder_implements:FileUploadResponse)
FileUploadResponseOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return File.internal_static_FileUploadResponse_descriptor;
}
@Override
protected FieldAccessorTable
internalGetFieldAccessorTable() {
return File.internal_static_FileUploadResponse_fieldAccessorTable
.ensureFieldAccessorsInitialized(
FileUploadResponse.class, Builder.class);
}
// Construct using com.ruoyi.grpc.file.FileUploadResponse.newBuilder()
private Builder() {
}
private Builder(
BuilderParent parent) {
super(parent);
}
@Override
public Builder clear() {
super.clear();
bitField0_ = 0;
status_ = "";
size_ = 0L;
return this;
}
@Override
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return File.internal_static_FileUploadResponse_descriptor;
}
@Override
public FileUploadResponse getDefaultInstanceForType() {
return FileUploadResponse.getDefaultInstance();
}
@Override
public FileUploadResponse build() {
FileUploadResponse result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
@Override
public FileUploadResponse buildPartial() {
FileUploadResponse result = new FileUploadResponse(this);
if (bitField0_ != 0) { buildPartial0(result); }
onBuilt();
return result;
}
private void buildPartial0(FileUploadResponse result) {
int from_bitField0_ = bitField0_;
if (((from_bitField0_ & 0x00000001) != 0)) {
result.status_ = status_;
}
if (((from_bitField0_ & 0x00000002) != 0)) {
result.size_ = size_;
}
}
@Override
public Builder clone() {
return super.clone();
}
@Override
public Builder setField(
com.google.protobuf.Descriptors.FieldDescriptor field,
Object value) {
return super.setField(field, value);
}
@Override
public Builder clearField(
com.google.protobuf.Descriptors.FieldDescriptor field) {
return super.clearField(field);
}
@Override
public Builder clearOneof(
com.google.protobuf.Descriptors.OneofDescriptor oneof) {
return super.clearOneof(oneof);
}
@Override
public Builder setRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
int index, Object value) {
return super.setRepeatedField(field, index, value);
}
@Override
public Builder addRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
Object value) {
return super.addRepeatedField(field, value);
}
@Override
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof FileUploadResponse) {
return mergeFrom((FileUploadResponse)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(FileUploadResponse other) {
if (other == FileUploadResponse.getDefaultInstance()) return this;
if (!other.getStatus().isEmpty()) {
status_ = other.status_;
bitField0_ |= 0x00000001;
onChanged();
}
if (other.getSize() != 0L) {
setSize(other.getSize());
}
this.mergeUnknownFields(other.getUnknownFields());
onChanged();
return this;
}
@Override
public final boolean isInitialized() {
return true;
}
@Override
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
if (extensionRegistry == null) {
throw new NullPointerException();
}
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
case 10: {
status_ = input.readStringRequireUtf8();
bitField0_ |= 0x00000001;
break;
} // case 10
case 16: {
size_ = input.readInt64();
bitField0_ |= 0x00000002;
break;
} // case 16
default: {
if (!super.parseUnknownField(input, extensionRegistry, tag)) {
done = true; // was an endgroup tag
}
break;
} // default:
} // switch (tag)
} // while (!done)
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.unwrapIOException();
} finally {
onChanged();
} // finally
return this;
}
private int bitField0_;
private Object status_ = "";
/**
* <code>string status = 1;</code>
* @return The status.
*/
public String getStatus() {
Object ref = status_;
if (!(ref instanceof String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
String s = bs.toStringUtf8();
status_ = s;
return s;
} else {
return (String) ref;
}
}
/**
* <code>string status = 1;</code>
* @return The bytes for status.
*/
public com.google.protobuf.ByteString
getStatusBytes() {
Object ref = status_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(String) ref);
status_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
* <code>string status = 1;</code>
* @param value The status to set.
* @return This builder for chaining.
*/
public Builder setStatus(
String value) {
if (value == null) { throw new NullPointerException(); }
status_ = value;
bitField0_ |= 0x00000001;
onChanged();
return this;
}
/**
* <code>string status = 1;</code>
* @return This builder for chaining.
*/
public Builder clearStatus() {
status_ = getDefaultInstance().getStatus();
bitField0_ = (bitField0_ & ~0x00000001);
onChanged();
return this;
}
/**
* <code>string status = 1;</code>
* @param value The bytes for status to set.
* @return This builder for chaining.
*/
public Builder setStatusBytes(
com.google.protobuf.ByteString value) {
if (value == null) { throw new NullPointerException(); }
checkByteStringIsUtf8(value);
status_ = value;
bitField0_ |= 0x00000001;
onChanged();
return this;
}
private long size_ ;
/**
* <code>int64 size = 2;</code>
* @return The size.
*/
@Override
public long getSize() {
return size_;
}
/**
* <code>int64 size = 2;</code>
* @param value The size to set.
* @return This builder for chaining.
*/
public Builder setSize(long value) {
size_ = value;
bitField0_ |= 0x00000002;
onChanged();
return this;
}
/**
* <code>int64 size = 2;</code>
* @return This builder for chaining.
*/
public Builder clearSize() {
bitField0_ = (bitField0_ & ~0x00000002);
size_ = 0L;
onChanged();
return this;
}
@Override
public final Builder setUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.setUnknownFields(unknownFields);
}
@Override
public final Builder mergeUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.mergeUnknownFields(unknownFields);
}
// @@protoc_insertion_point(builder_scope:FileUploadResponse)
}
// @@protoc_insertion_point(class_scope:FileUploadResponse)
private static final FileUploadResponse DEFAULT_INSTANCE;
static {
DEFAULT_INSTANCE = new FileUploadResponse();
}
public static FileUploadResponse getDefaultInstance() {
return DEFAULT_INSTANCE;
}
private static final com.google.protobuf.Parser<FileUploadResponse>
PARSER = new com.google.protobuf.AbstractParser<FileUploadResponse>() {
@Override
public FileUploadResponse parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
Builder builder = newBuilder();
try {
builder.mergeFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(builder.buildPartial());
} catch (com.google.protobuf.UninitializedMessageException e) {
throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial());
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(e)
.setUnfinishedMessage(builder.buildPartial());
}
return builder.buildPartial();
}
};
public static com.google.protobuf.Parser<FileUploadResponse> parser() {
return PARSER;
}
@Override
public com.google.protobuf.Parser<FileUploadResponse> getParserForType() {
return PARSER;
}
@Override
public FileUploadResponse getDefaultInstanceForType() {
return DEFAULT_INSTANCE;
}
}
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: file.proto
package com.ruoyi.grpc.file;
public interface FileUploadResponseOrBuilder extends
// @@protoc_insertion_point(interface_extends:FileUploadResponse)
com.google.protobuf.MessageOrBuilder {
/**
* <code>string status = 1;</code>
* @return The status.
*/
String getStatus();
/**
* <code>string status = 1;</code>
* @return The bytes for status.
*/
com.google.protobuf.ByteString
getStatusBytes();
/**
* <code>int64 size = 2;</code>
* @return The size.
*/
long getSize();
}
package com.ruoyi.client.server; package com.ruoyi.grpc.server;
import com.ruoyi.client.service.FileServiceImpl; import com.ruoyi.grpc.service.FileServiceImpl;
import io.grpc.Server; import io.grpc.Server;
import io.grpc.ServerBuilder; import io.grpc.ServerBuilder;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -11,15 +11,15 @@ import org.springframework.stereotype.Component; ...@@ -11,15 +11,15 @@ import org.springframework.stereotype.Component;
public class GrpcFileServer { public class GrpcFileServer {
@Autowired @Autowired
private FileServiceImpl fileServiceImpl; private FileServiceImpl fileService;
public void initServer(){ public void initServer(){
try { try {
// 创建服务实例 // 创建服务实例
Server server = ServerBuilder.forPort(50051) Server server = ServerBuilder.forPort(50051)
.addService(fileServiceImpl) // 关键控制器注册 .addService(fileService) // 关键控制器注册
.build(); .build();
server.start(); server.start();
System.out.println("Server started on port 50051"); System.out.println("Server started on port 50051");
......
package com.ruoyi.client.service; package com.ruoyi.grpc.service;
import com.google.protobuf.ByteString; import com.google.protobuf.ByteString;
import com.ruoyi.grpc.file.*; import com.ruoyi.grpc.file.*;
import com.ruoyi.user.dto.ClientUserOnline;
import com.ruoyi.user.service.TokenApiService;
import com.ruoyi.watch.service.INmyUserWatchSubscribeService;
import com.ruoyi.websocket.dto.WebSocketMsgDto;
import com.ruoyi.websocket.service.WebSocketService;
import io.grpc.Status; import io.grpc.Status;
import io.grpc.stub.StreamObserver; import io.grpc.stub.StreamObserver;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
@Service @Service
public class FileServiceImpl extends FileServiceGrpc.FileServiceImplBase { public class FileServiceImpl extends FileServiceGrpc.FileServiceImplBase {
private static final Logger log = LoggerFactory.getLogger(FileServiceImpl.class);
@Value("${server.upload.base_path}") @Value("${server.upload.base_path}")
String uploadBasePath; String uploadBasePath;
@Autowired
private TokenApiService tokenApiService;
@Autowired
private INmyUserWatchSubscribeService myUserWatchSubscribeService;
@Autowired
private WebSocketService webSocketService;
@Override @Override
public StreamObserver<FileUploadRequest> uploadFile(StreamObserver<FileUploadResponse> responseObserver) { public StreamObserver<FileUploadRequest> uploadFile(StreamObserver<FileUploadResponse> responseObserver) {
return new StreamObserver<FileUploadRequest>() { return new StreamObserver<FileUploadRequest>() {
// 定义成员变量保存上下文信息
private String filename; private String filename;
private String token;
private Long userId;
private Long deviceId;
private String changeBasePath;
private FileOutputStream fos; private FileOutputStream fos;
private long totalSize = 0; private long totalSize = 0;
...@@ -28,7 +54,19 @@ public class FileServiceImpl extends FileServiceGrpc.FileServiceImplBase { ...@@ -28,7 +54,19 @@ public class FileServiceImpl extends FileServiceGrpc.FileServiceImplBase {
public void onNext(FileUploadRequest request) { public void onNext(FileUploadRequest request) {
try { try {
if (request.hasFilename()) { if (request.hasFilename()) {
filename = request.getFilename();
// 保存首个请求块中的元数据
this.filename = request.getFilename();
this.token = request.getToken();
this.changeBasePath = request.getBasePath();
// 解析用户信息
ClientUserOnline loginUser = tokenApiService.getLoginUser();
if (loginUser == null) {
throw new RuntimeException("无效Token: " + token);
}
this.userId = loginUser.getUserId();
this.deviceId = loginUser.getDeviceId();
// 创建文件对象 // 创建文件对象
java.io.File ioFile = new java.io.File(uploadBasePath + filename); java.io.File ioFile = new java.io.File(uploadBasePath + filename);
// 创建文件所在的目录 // 创建文件所在的目录
...@@ -44,6 +82,7 @@ public class FileServiceImpl extends FileServiceGrpc.FileServiceImplBase { ...@@ -44,6 +82,7 @@ public class FileServiceImpl extends FileServiceGrpc.FileServiceImplBase {
} }
}catch (Exception e){ }catch (Exception e){
e.printStackTrace(); e.printStackTrace();
cleanupResources();
// 返回 INVALID_ARGUMENT 错误 // 返回 INVALID_ARGUMENT 错误
responseObserver.onError(Status.INVALID_ARGUMENT responseObserver.onError(Status.INVALID_ARGUMENT
.withDescription("Upload failed:" + e.getMessage()) .withDescription("Upload failed:" + e.getMessage())
...@@ -54,6 +93,7 @@ public class FileServiceImpl extends FileServiceGrpc.FileServiceImplBase { ...@@ -54,6 +93,7 @@ public class FileServiceImpl extends FileServiceGrpc.FileServiceImplBase {
@Override @Override
public void onError(Throwable t) { public void onError(Throwable t) {
cleanupResources();
System.err.println("客户端中断上传: " + t.getMessage()); System.err.println("客户端中断上传: " + t.getMessage());
} }
...@@ -66,6 +106,13 @@ public class FileServiceImpl extends FileServiceGrpc.FileServiceImplBase { ...@@ -66,6 +106,13 @@ public class FileServiceImpl extends FileServiceGrpc.FileServiceImplBase {
.setSize(totalSize) .setSize(totalSize)
.build()); .build());
responseObserver.onCompleted(); responseObserver.onCompleted();
//发消息让该同步的客户端进行同步的消息
List<WebSocketMsgDto> webSocketSendMsg = myUserWatchSubscribeService.getWebSocketSendMsg(userId, deviceId, changeBasePath);
//TODO
webSocketService.sendMsg(new ArrayList<>(),"add");
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
// 最终错误处理 // 最终错误处理
...@@ -74,6 +121,17 @@ public class FileServiceImpl extends FileServiceGrpc.FileServiceImplBase { ...@@ -74,6 +121,17 @@ public class FileServiceImpl extends FileServiceGrpc.FileServiceImplBase {
.asRuntimeException()); .asRuntimeException());
} }
} }
private void cleanupResources() {
try {
if (fos != null) {
fos.close();
}
} catch (IOException e) {
log.warn("文件流关闭异常", e);
}
}
}; };
} }
......
...@@ -2,7 +2,6 @@ syntax = "proto3"; ...@@ -2,7 +2,6 @@ syntax = "proto3";
option java_multiple_files = true; option java_multiple_files = true;
option java_package = "com.ruoyi.grpc.file"; option java_package = "com.ruoyi.grpc.file";
option go_package = "./pb";
message FileUploadRequest { message FileUploadRequest {
//表示这两个字段只能有一个被设置值,要么是文件名称要么是文件块 //表示这两个字段只能有一个被设置值,要么是文件名称要么是文件块
...@@ -10,6 +9,9 @@ message FileUploadRequest { ...@@ -10,6 +9,9 @@ message FileUploadRequest {
string filename = 1; string filename = 1;
bytes chunk = 2; bytes chunk = 2;
} }
//监控的资源需要上传,服务端要判断是哪个资源变化了,更新对应目录下面的文件,并同步给需要的客户端
string basePath = 3;
string token = 4;
} }
message FileUploadResponse { message FileUploadResponse {
......
...@@ -47,15 +47,12 @@ user: ...@@ -47,15 +47,12 @@ user:
# Spring配置 # Spring配置
spring: spring:
# 引入项目自定义文件
config:
import: "optional:classpath:server-config.yml"
# 资源信息 # 资源信息
messages: messages:
# 国际化资源文件路径 # 国际化资源文件路径
basename: i18n/messages basename: i18n/messages
profiles: profiles:
active: druid active: druid,dev
# 文件上传 # 文件上传
servlet: servlet:
multipart: multipart:
...@@ -132,3 +129,9 @@ xss: ...@@ -132,3 +129,9 @@ xss:
urlPatterns: /system/*,/monitor/*,/tool/* urlPatterns: /system/*,/monitor/*,/tool/*
# token配置给客户端
tokenapi: # 令牌自定义标识
header: Authorization
# 令牌密钥
secret: abcdefghijklmnopqrstuvwxyz
server:
upload:
base_path : E:\server_file\ #文件上传至服务器的路径
...@@ -16,6 +16,16 @@ ...@@ -16,6 +16,16 @@
</description> </description>
<dependencies> <dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<!-- 防止进入swagger页面报类型转换错误,排除3.0.0中的引用,手动增加1.6.2版本 -->
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-models</artifactId>
<version>1.6.2</version>
</dependency>
<!-- Spring框架基本的核心工具 --> <!-- Spring框架基本的核心工具 -->
<dependency> <dependency>
......
...@@ -114,7 +114,7 @@ public class SecurityConfig ...@@ -114,7 +114,7 @@ public class SecurityConfig
requests.antMatchers("/login", "/register", "/captchaImage").permitAll() requests.antMatchers("/login", "/register", "/captchaImage").permitAll()
// 静态资源,可匿名访问 // 静态资源,可匿名访问
.antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll() .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
.antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll() .antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**","/ws/**").permitAll()
// 除上面外的所有请求全部需要鉴权认证 // 除上面外的所有请求全部需要鉴权认证
.anyRequest().authenticated(); .anyRequest().authenticated();
}) })
......
...@@ -16,13 +16,27 @@ ...@@ -16,13 +16,27 @@
</description> </description>
<dependencies> <dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<!-- kafka -->
<dependency>
<groupId>org.springframework.kafka</groupId>
<artifactId>spring-kafka</artifactId>
</dependency>
<!-- 通用工具--> <!-- 通用工具-->
<dependency> <dependency>
<groupId>com.ruoyi</groupId> <groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common</artifactId> <artifactId>ruoyi-common</artifactId>
</dependency> </dependency>
<!-- websocket -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-websocket</artifactId>
</dependency>
</dependencies> </dependencies>
</project> </project>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment