- client: added GetFileDirectory, DeleteFile, and GetFile service implementation
parent
f064d16553
commit
acf5c15746
@ -0,0 +1,41 @@
|
||||
/**
|
||||
* This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org)
|
||||
*/
|
||||
|
||||
package org.openmuc.openiec61850.internal.mms.asn1;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.EOFException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.math.BigInteger;
|
||||
import java.io.Serializable;
|
||||
import org.openmuc.jasn1.ber.*;
|
||||
import org.openmuc.jasn1.ber.types.*;
|
||||
import org.openmuc.jasn1.ber.types.string.*;
|
||||
|
||||
|
||||
public class FileCloseRequest extends Integer32 {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public FileCloseRequest() {
|
||||
}
|
||||
|
||||
public FileCloseRequest(byte[] code) {
|
||||
super(code);
|
||||
}
|
||||
|
||||
public FileCloseRequest(BigInteger value) {
|
||||
super(value);
|
||||
}
|
||||
|
||||
public FileCloseRequest(long value) {
|
||||
super(value);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
/**
|
||||
* This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org)
|
||||
*/
|
||||
|
||||
package org.openmuc.openiec61850.internal.mms.asn1;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.EOFException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.math.BigInteger;
|
||||
import java.io.Serializable;
|
||||
import org.openmuc.jasn1.ber.*;
|
||||
import org.openmuc.jasn1.ber.types.*;
|
||||
import org.openmuc.jasn1.ber.types.string.*;
|
||||
|
||||
|
||||
public class FileCloseResponse extends BerNull {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public FileCloseResponse() {
|
||||
}
|
||||
|
||||
public FileCloseResponse(byte[] code) {
|
||||
super(code);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
/**
|
||||
* This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org)
|
||||
*/
|
||||
|
||||
package org.openmuc.openiec61850.internal.mms.asn1;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.EOFException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.math.BigInteger;
|
||||
import java.io.Serializable;
|
||||
import org.openmuc.jasn1.ber.*;
|
||||
import org.openmuc.jasn1.ber.types.*;
|
||||
import org.openmuc.jasn1.ber.types.string.*;
|
||||
|
||||
|
||||
public class FileDeleteRequest extends FileName {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public FileDeleteRequest() {
|
||||
}
|
||||
|
||||
public FileDeleteRequest(byte[] code) {
|
||||
super(code);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
/**
|
||||
* This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org)
|
||||
*/
|
||||
|
||||
package org.openmuc.openiec61850.internal.mms.asn1;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.EOFException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.math.BigInteger;
|
||||
import java.io.Serializable;
|
||||
import org.openmuc.jasn1.ber.*;
|
||||
import org.openmuc.jasn1.ber.types.*;
|
||||
import org.openmuc.jasn1.ber.types.string.*;
|
||||
|
||||
|
||||
public class FileDeleteResponse extends BerNull {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public FileDeleteResponse() {
|
||||
}
|
||||
|
||||
public FileDeleteResponse(byte[] code) {
|
||||
super(code);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,179 @@
|
||||
/**
|
||||
* This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org)
|
||||
*/
|
||||
|
||||
package org.openmuc.openiec61850.internal.mms.asn1;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.EOFException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.math.BigInteger;
|
||||
import java.io.Serializable;
|
||||
import org.openmuc.jasn1.ber.*;
|
||||
import org.openmuc.jasn1.ber.types.*;
|
||||
import org.openmuc.jasn1.ber.types.string.*;
|
||||
|
||||
|
||||
public class FileOpenRequest implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
|
||||
|
||||
public byte[] code = null;
|
||||
private FileName fileName = null;
|
||||
private Unsigned32 initialPosition = null;
|
||||
|
||||
public FileOpenRequest() {
|
||||
}
|
||||
|
||||
public FileOpenRequest(byte[] code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public void setFileName(FileName fileName) {
|
||||
this.fileName = fileName;
|
||||
}
|
||||
|
||||
public FileName getFileName() {
|
||||
return fileName;
|
||||
}
|
||||
|
||||
public void setInitialPosition(Unsigned32 initialPosition) {
|
||||
this.initialPosition = initialPosition;
|
||||
}
|
||||
|
||||
public Unsigned32 getInitialPosition() {
|
||||
return initialPosition;
|
||||
}
|
||||
|
||||
public int encode(OutputStream os) throws IOException {
|
||||
return encode(os, true);
|
||||
}
|
||||
|
||||
public int encode(OutputStream os, boolean withTag) throws IOException {
|
||||
|
||||
if (code != null) {
|
||||
for (int i = code.length - 1; i >= 0; i--) {
|
||||
os.write(code[i]);
|
||||
}
|
||||
if (withTag) {
|
||||
return tag.encode(os) + code.length;
|
||||
}
|
||||
return code.length;
|
||||
}
|
||||
|
||||
int codeLength = 0;
|
||||
codeLength += initialPosition.encode(os, false);
|
||||
// write tag: CONTEXT_CLASS, PRIMITIVE, 1
|
||||
os.write(0x81);
|
||||
codeLength += 1;
|
||||
|
||||
codeLength += fileName.encode(os, false);
|
||||
// write tag: CONTEXT_CLASS, CONSTRUCTED, 0
|
||||
os.write(0xA0);
|
||||
codeLength += 1;
|
||||
|
||||
codeLength += BerLength.encodeLength(os, codeLength);
|
||||
|
||||
if (withTag) {
|
||||
codeLength += tag.encode(os);
|
||||
}
|
||||
|
||||
return codeLength;
|
||||
|
||||
}
|
||||
|
||||
public int decode(InputStream is) throws IOException {
|
||||
return decode(is, true);
|
||||
}
|
||||
|
||||
public int decode(InputStream is, boolean withTag) throws IOException {
|
||||
int codeLength = 0;
|
||||
int subCodeLength = 0;
|
||||
BerTag berTag = new BerTag();
|
||||
|
||||
if (withTag) {
|
||||
codeLength += tag.decodeAndCheck(is);
|
||||
}
|
||||
|
||||
BerLength length = new BerLength();
|
||||
codeLength += length.decode(is);
|
||||
|
||||
int totalLength = length.val;
|
||||
codeLength += totalLength;
|
||||
|
||||
subCodeLength += berTag.decode(is);
|
||||
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 0)) {
|
||||
fileName = new FileName();
|
||||
subCodeLength += fileName.decode(is, false);
|
||||
subCodeLength += berTag.decode(is);
|
||||
}
|
||||
else {
|
||||
throw new IOException("Tag does not match the mandatory sequence element tag.");
|
||||
}
|
||||
|
||||
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 1)) {
|
||||
initialPosition = new Unsigned32();
|
||||
subCodeLength += initialPosition.decode(is, false);
|
||||
if (subCodeLength == totalLength) {
|
||||
return codeLength;
|
||||
}
|
||||
}
|
||||
throw new IOException("Unexpected end of sequence, length tag: " + totalLength + ", actual sequence length: " + subCodeLength);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void encodeAndSave(int encodingSizeGuess) throws IOException {
|
||||
ReverseByteArrayOutputStream os = new ReverseByteArrayOutputStream(encodingSizeGuess);
|
||||
encode(os, false);
|
||||
code = os.getArray();
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
appendAsString(sb, 0);
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public void appendAsString(StringBuilder sb, int indentLevel) {
|
||||
|
||||
sb.append("{");
|
||||
sb.append("\n");
|
||||
for (int i = 0; i < indentLevel + 1; i++) {
|
||||
sb.append("\t");
|
||||
}
|
||||
if (fileName != null) {
|
||||
sb.append("fileName: ");
|
||||
fileName.appendAsString(sb, indentLevel + 1);
|
||||
}
|
||||
else {
|
||||
sb.append("fileName: <empty-required-field>");
|
||||
}
|
||||
|
||||
sb.append(",\n");
|
||||
for (int i = 0; i < indentLevel + 1; i++) {
|
||||
sb.append("\t");
|
||||
}
|
||||
if (initialPosition != null) {
|
||||
sb.append("initialPosition: ").append(initialPosition);
|
||||
}
|
||||
else {
|
||||
sb.append("initialPosition: <empty-required-field>");
|
||||
}
|
||||
|
||||
sb.append("\n");
|
||||
for (int i = 0; i < indentLevel; i++) {
|
||||
sb.append("\t");
|
||||
}
|
||||
sb.append("}");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,179 @@
|
||||
/**
|
||||
* This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org)
|
||||
*/
|
||||
|
||||
package org.openmuc.openiec61850.internal.mms.asn1;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.EOFException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.math.BigInteger;
|
||||
import java.io.Serializable;
|
||||
import org.openmuc.jasn1.ber.*;
|
||||
import org.openmuc.jasn1.ber.types.*;
|
||||
import org.openmuc.jasn1.ber.types.string.*;
|
||||
|
||||
|
||||
public class FileOpenResponse implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
|
||||
|
||||
public byte[] code = null;
|
||||
private Integer32 frsmID = null;
|
||||
private FileAttributes fileAttributes = null;
|
||||
|
||||
public FileOpenResponse() {
|
||||
}
|
||||
|
||||
public FileOpenResponse(byte[] code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public void setFrsmID(Integer32 frsmID) {
|
||||
this.frsmID = frsmID;
|
||||
}
|
||||
|
||||
public Integer32 getFrsmID() {
|
||||
return frsmID;
|
||||
}
|
||||
|
||||
public void setFileAttributes(FileAttributes fileAttributes) {
|
||||
this.fileAttributes = fileAttributes;
|
||||
}
|
||||
|
||||
public FileAttributes getFileAttributes() {
|
||||
return fileAttributes;
|
||||
}
|
||||
|
||||
public int encode(OutputStream os) throws IOException {
|
||||
return encode(os, true);
|
||||
}
|
||||
|
||||
public int encode(OutputStream os, boolean withTag) throws IOException {
|
||||
|
||||
if (code != null) {
|
||||
for (int i = code.length - 1; i >= 0; i--) {
|
||||
os.write(code[i]);
|
||||
}
|
||||
if (withTag) {
|
||||
return tag.encode(os) + code.length;
|
||||
}
|
||||
return code.length;
|
||||
}
|
||||
|
||||
int codeLength = 0;
|
||||
codeLength += fileAttributes.encode(os, false);
|
||||
// write tag: CONTEXT_CLASS, CONSTRUCTED, 1
|
||||
os.write(0xA1);
|
||||
codeLength += 1;
|
||||
|
||||
codeLength += frsmID.encode(os, false);
|
||||
// write tag: CONTEXT_CLASS, PRIMITIVE, 0
|
||||
os.write(0x80);
|
||||
codeLength += 1;
|
||||
|
||||
codeLength += BerLength.encodeLength(os, codeLength);
|
||||
|
||||
if (withTag) {
|
||||
codeLength += tag.encode(os);
|
||||
}
|
||||
|
||||
return codeLength;
|
||||
|
||||
}
|
||||
|
||||
public int decode(InputStream is) throws IOException {
|
||||
return decode(is, true);
|
||||
}
|
||||
|
||||
public int decode(InputStream is, boolean withTag) throws IOException {
|
||||
int codeLength = 0;
|
||||
int subCodeLength = 0;
|
||||
BerTag berTag = new BerTag();
|
||||
|
||||
if (withTag) {
|
||||
codeLength += tag.decodeAndCheck(is);
|
||||
}
|
||||
|
||||
BerLength length = new BerLength();
|
||||
codeLength += length.decode(is);
|
||||
|
||||
int totalLength = length.val;
|
||||
codeLength += totalLength;
|
||||
|
||||
subCodeLength += berTag.decode(is);
|
||||
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 0)) {
|
||||
frsmID = new Integer32();
|
||||
subCodeLength += frsmID.decode(is, false);
|
||||
subCodeLength += berTag.decode(is);
|
||||
}
|
||||
else {
|
||||
throw new IOException("Tag does not match the mandatory sequence element tag.");
|
||||
}
|
||||
|
||||
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 1)) {
|
||||
fileAttributes = new FileAttributes();
|
||||
subCodeLength += fileAttributes.decode(is, false);
|
||||
if (subCodeLength == totalLength) {
|
||||
return codeLength;
|
||||
}
|
||||
}
|
||||
throw new IOException("Unexpected end of sequence, length tag: " + totalLength + ", actual sequence length: " + subCodeLength);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void encodeAndSave(int encodingSizeGuess) throws IOException {
|
||||
ReverseByteArrayOutputStream os = new ReverseByteArrayOutputStream(encodingSizeGuess);
|
||||
encode(os, false);
|
||||
code = os.getArray();
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
appendAsString(sb, 0);
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public void appendAsString(StringBuilder sb, int indentLevel) {
|
||||
|
||||
sb.append("{");
|
||||
sb.append("\n");
|
||||
for (int i = 0; i < indentLevel + 1; i++) {
|
||||
sb.append("\t");
|
||||
}
|
||||
if (frsmID != null) {
|
||||
sb.append("frsmID: ").append(frsmID);
|
||||
}
|
||||
else {
|
||||
sb.append("frsmID: <empty-required-field>");
|
||||
}
|
||||
|
||||
sb.append(",\n");
|
||||
for (int i = 0; i < indentLevel + 1; i++) {
|
||||
sb.append("\t");
|
||||
}
|
||||
if (fileAttributes != null) {
|
||||
sb.append("fileAttributes: ");
|
||||
fileAttributes.appendAsString(sb, indentLevel + 1);
|
||||
}
|
||||
else {
|
||||
sb.append("fileAttributes: <empty-required-field>");
|
||||
}
|
||||
|
||||
sb.append("\n");
|
||||
for (int i = 0; i < indentLevel; i++) {
|
||||
sb.append("\t");
|
||||
}
|
||||
sb.append("}");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,41 @@
|
||||
/**
|
||||
* This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org)
|
||||
*/
|
||||
|
||||
package org.openmuc.openiec61850.internal.mms.asn1;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.EOFException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.math.BigInteger;
|
||||
import java.io.Serializable;
|
||||
import org.openmuc.jasn1.ber.*;
|
||||
import org.openmuc.jasn1.ber.types.*;
|
||||
import org.openmuc.jasn1.ber.types.string.*;
|
||||
|
||||
|
||||
public class FileReadRequest extends Integer32 {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public FileReadRequest() {
|
||||
}
|
||||
|
||||
public FileReadRequest(byte[] code) {
|
||||
super(code);
|
||||
}
|
||||
|
||||
public FileReadRequest(BigInteger value) {
|
||||
super(value);
|
||||
}
|
||||
|
||||
public FileReadRequest(long value) {
|
||||
super(value);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,180 @@
|
||||
/**
|
||||
* This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org)
|
||||
*/
|
||||
|
||||
package org.openmuc.openiec61850.internal.mms.asn1;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.EOFException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.math.BigInteger;
|
||||
import java.io.Serializable;
|
||||
import org.openmuc.jasn1.ber.*;
|
||||
import org.openmuc.jasn1.ber.types.*;
|
||||
import org.openmuc.jasn1.ber.types.string.*;
|
||||
|
||||
|
||||
public class FileReadResponse implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
|
||||
|
||||
public byte[] code = null;
|
||||
private BerOctetString fileData = null;
|
||||
private BerBoolean moreFollows = null;
|
||||
|
||||
public FileReadResponse() {
|
||||
}
|
||||
|
||||
public FileReadResponse(byte[] code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public void setFileData(BerOctetString fileData) {
|
||||
this.fileData = fileData;
|
||||
}
|
||||
|
||||
public BerOctetString getFileData() {
|
||||
return fileData;
|
||||
}
|
||||
|
||||
public void setMoreFollows(BerBoolean moreFollows) {
|
||||
this.moreFollows = moreFollows;
|
||||
}
|
||||
|
||||
public BerBoolean getMoreFollows() {
|
||||
return moreFollows;
|
||||
}
|
||||
|
||||
public int encode(OutputStream os) throws IOException {
|
||||
return encode(os, true);
|
||||
}
|
||||
|
||||
public int encode(OutputStream os, boolean withTag) throws IOException {
|
||||
|
||||
if (code != null) {
|
||||
for (int i = code.length - 1; i >= 0; i--) {
|
||||
os.write(code[i]);
|
||||
}
|
||||
if (withTag) {
|
||||
return tag.encode(os) + code.length;
|
||||
}
|
||||
return code.length;
|
||||
}
|
||||
|
||||
int codeLength = 0;
|
||||
if (moreFollows != null) {
|
||||
codeLength += moreFollows.encode(os, false);
|
||||
// write tag: CONTEXT_CLASS, PRIMITIVE, 1
|
||||
os.write(0x81);
|
||||
codeLength += 1;
|
||||
}
|
||||
|
||||
codeLength += fileData.encode(os, false);
|
||||
// write tag: CONTEXT_CLASS, PRIMITIVE, 0
|
||||
os.write(0x80);
|
||||
codeLength += 1;
|
||||
|
||||
codeLength += BerLength.encodeLength(os, codeLength);
|
||||
|
||||
if (withTag) {
|
||||
codeLength += tag.encode(os);
|
||||
}
|
||||
|
||||
return codeLength;
|
||||
|
||||
}
|
||||
|
||||
public int decode(InputStream is) throws IOException {
|
||||
return decode(is, true);
|
||||
}
|
||||
|
||||
public int decode(InputStream is, boolean withTag) throws IOException {
|
||||
int codeLength = 0;
|
||||
int subCodeLength = 0;
|
||||
BerTag berTag = new BerTag();
|
||||
|
||||
if (withTag) {
|
||||
codeLength += tag.decodeAndCheck(is);
|
||||
}
|
||||
|
||||
BerLength length = new BerLength();
|
||||
codeLength += length.decode(is);
|
||||
|
||||
int totalLength = length.val;
|
||||
codeLength += totalLength;
|
||||
|
||||
subCodeLength += berTag.decode(is);
|
||||
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 0)) {
|
||||
fileData = new BerOctetString();
|
||||
subCodeLength += fileData.decode(is, false);
|
||||
if (subCodeLength == totalLength) {
|
||||
return codeLength;
|
||||
}
|
||||
subCodeLength += berTag.decode(is);
|
||||
}
|
||||
else {
|
||||
throw new IOException("Tag does not match the mandatory sequence element tag.");
|
||||
}
|
||||
|
||||
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 1)) {
|
||||
moreFollows = new BerBoolean();
|
||||
subCodeLength += moreFollows.decode(is, false);
|
||||
if (subCodeLength == totalLength) {
|
||||
return codeLength;
|
||||
}
|
||||
}
|
||||
throw new IOException("Unexpected end of sequence, length tag: " + totalLength + ", actual sequence length: " + subCodeLength);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void encodeAndSave(int encodingSizeGuess) throws IOException {
|
||||
ReverseByteArrayOutputStream os = new ReverseByteArrayOutputStream(encodingSizeGuess);
|
||||
encode(os, false);
|
||||
code = os.getArray();
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
appendAsString(sb, 0);
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public void appendAsString(StringBuilder sb, int indentLevel) {
|
||||
|
||||
sb.append("{");
|
||||
sb.append("\n");
|
||||
for (int i = 0; i < indentLevel + 1; i++) {
|
||||
sb.append("\t");
|
||||
}
|
||||
if (fileData != null) {
|
||||
sb.append("fileData: ").append(fileData);
|
||||
}
|
||||
else {
|
||||
sb.append("fileData: <empty-required-field>");
|
||||
}
|
||||
|
||||
if (moreFollows != null) {
|
||||
sb.append(",\n");
|
||||
for (int i = 0; i < indentLevel + 1; i++) {
|
||||
sb.append("\t");
|
||||
}
|
||||
sb.append("moreFollows: ").append(moreFollows);
|
||||
}
|
||||
|
||||
sb.append("\n");
|
||||
for (int i = 0; i < indentLevel; i++) {
|
||||
sb.append("\t");
|
||||
}
|
||||
sb.append("}");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,39 @@
|
||||
package org.openmuc.openiec61850;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
||||
/**
|
||||
* @brief Contains file information received by the GetFileDirectory service
|
||||
*/
|
||||
public class FileInformation
|
||||
{
|
||||
|
||||
private String filename;
|
||||
|
||||
private long fileSize;
|
||||
|
||||
private Calendar lastModified;
|
||||
|
||||
public String getFilename() {
|
||||
return filename;
|
||||
}
|
||||
|
||||
public long getFileSize() {
|
||||
return fileSize;
|
||||
}
|
||||
|
||||
public Calendar getLastModified() {
|
||||
return lastModified;
|
||||
}
|
||||
|
||||
public FileInformation(String filename, long fileSize,
|
||||
Calendar lastModified)
|
||||
{
|
||||
super();
|
||||
this.filename = filename;
|
||||
this.fileSize = fileSize;
|
||||
this.lastModified = lastModified;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package org.openmuc.openiec61850;
|
||||
|
||||
/**
|
||||
* Callback handler for GetFile service
|
||||
*/
|
||||
public interface GetFileListener
|
||||
{
|
||||
/**
|
||||
* Is called when a new block of file data is received
|
||||
*
|
||||
* @param fileData block of file data received
|
||||
* @param moreFollows true if more data blocks will follow, false otherwise
|
||||
*
|
||||
* @return true to continue the GetFile service, false to cancel
|
||||
*/
|
||||
boolean dataReceived(byte[] fileData, boolean moreFollows);
|
||||
}
|
Loading…
Reference in New Issue