public int decode(InputStream is, boolean withTag) throws IOException { int codeLength = 0; int subCodeLength = 0; if (withTag) { codeLength += tag.decodeAndCheck(is); } BerLength length = new BerLength(); codeLength += length.decode(is); int totalLength = length.val; while (subCodeLength < totalLength) { BerGraphicString element = new BerGraphicString(); subCodeLength += element.decode(is, true); seqOf.add(element); } if (subCodeLength != totalLength) { throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength + " but has " + subCodeLength); } codeLength += subCodeLength; return codeLength; }
@Override public int encode(OutputStream reverseOS, boolean withTag) throws IOException { int codeLength; codeLength = super.encode(reverseOS, false); if (withTag) { codeLength += tag.encode(reverseOS); } return codeLength; }
@Override public int decode(InputStream is, boolean withTag) throws IOException { int codeLength = 0; if (withTag) { codeLength += tag.decodeAndCheck(is); } codeLength += super.decode(is, false); return codeLength; }
BerGraphicString berGraphicString = new BerGraphicString(directoryName.getBytes()); FileName continueAfterSpecification = new FileName(); continueAfterSpecification.getBerGraphicString().add(new BerGraphicString(continueAfter.getBytes()));
filename.append(bgs.toString());
@Override public int decode(InputStream is, boolean withTag) throws IOException { int codeLength = 0; if (withTag) { codeLength += tag.decodeAndCheck(is); } codeLength += super.decode(is, false); return codeLength; }
BerGraphicString berGraphicString = new BerGraphicString(directoryName.getBytes()); FileName continueAfterSpecification = new FileName(); continueAfterSpecification.getBerGraphicString().add(new BerGraphicString(continueAfter.getBytes()));
filename.append(bgs.toString());
public int decode(InputStream is, boolean withTag) throws IOException { int codeLength = 0; int subCodeLength = 0; if (withTag) { codeLength += tag.decodeAndCheck(is); } BerLength length = new BerLength(); codeLength += length.decode(is); int totalLength = length.val; while (subCodeLength < totalLength) { BerGraphicString element = new BerGraphicString(); subCodeLength += element.decode(is, true); seqOf.add(element); } if (subCodeLength != totalLength) { throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength + " but has " + subCodeLength); } codeLength += subCodeLength; return codeLength; }
@Override public int encode(OutputStream reverseOS, boolean withTag) throws IOException { int codeLength; codeLength = super.encode(reverseOS, false); if (withTag) { codeLength += tag.encode(reverseOS); } return codeLength; }
@Override public int decode(InputStream is, boolean withTag) throws IOException { int codeLength = 0; if (withTag) { codeLength += tag.decodeAndCheck(is); } codeLength += super.decode(is, false); return codeLength; }
/** * Delete a file from the server * * @param filename * name of the file to delete * * @throws ServiceError * if a ServiceError is returned by the server * @throws IOException * if a fatal association error occurs. The association object will be closed and can no longer be used * after this exception is thrown. */ public void deleteFile(String filename) throws ServiceError, IOException { FileDeleteRequest fileDeleteRequest = new FileDeleteRequest(); fileDeleteRequest.getBerGraphicString().add(new BerGraphicString(filename.getBytes())); ConfirmedServiceRequest confirmedServiceRequest = new ConfirmedServiceRequest(); confirmedServiceRequest.setFileDelete(fileDeleteRequest); ConfirmedServiceResponse confirmedServiceResponse = encodeWriteReadDecode(confirmedServiceRequest); if (confirmedServiceResponse.getFileDelete() == null) { throw new ServiceError(ServiceError.FAILED_DUE_TO_COMMUNICATIONS_CONSTRAINT, "Error decoding DeleteFileResponsePdu"); } }
public int decode(InputStream is, BerTag berTag) throws IOException { int codeLength = 0; BerTag passedTag = berTag; if (berTag == null) { berTag = new BerTag(); codeLength += berTag.decode(is); } if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 0)) { charstring = new BerGraphicString(); codeLength += charstring.decode(is, false); return codeLength; } if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 1)) { bitstring = new BerBitString(); codeLength += bitstring.decode(is, false); return codeLength; } if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 2)) { external = new Myexternal2(); codeLength += external.decode(is, false); return codeLength; } if (passedTag != null) { return 0; } throw new IOException("Error decoding CHOICE: Tag " + berTag + " matched to no item."); }
@Override public int encode(OutputStream reverseOS, boolean withTag) throws IOException { int codeLength; codeLength = super.encode(reverseOS, false); if (withTag) { codeLength += tag.encode(reverseOS); } return codeLength; }
public int decode(InputStream is, boolean withTag) throws IOException { int codeLength = 0; if (withTag) { codeLength += tag.decodeAndCheck(is); } codeLength += super.decode(is, false); return codeLength; }
/** * Delete a file from the server * * @param filename * name of the file to delete * * @throws ServiceError * if a ServiceError is returned by the server * @throws IOException * if a fatal association error occurs. The association object will be closed and can no longer be used * after this exception is thrown. */ public void deleteFile(String filename) throws ServiceError, IOException { FileDeleteRequest fileDeleteRequest = new FileDeleteRequest(); fileDeleteRequest.getBerGraphicString().add(new BerGraphicString(filename.getBytes())); ConfirmedServiceRequest confirmedServiceRequest = new ConfirmedServiceRequest(); confirmedServiceRequest.setFileDelete(fileDeleteRequest); ConfirmedServiceResponse confirmedServiceResponse = encodeWriteReadDecode(confirmedServiceRequest); if (confirmedServiceResponse.getFileDelete() == null) { throw new ServiceError(ServiceError.FAILED_DUE_TO_COMMUNICATIONS_CONSTRAINT, "Error decoding DeleteFileResponsePdu"); } }
public int decode(InputStream is, BerTag berTag) throws IOException { int codeLength = 0; BerTag passedTag = berTag; if (berTag == null) { berTag = new BerTag(); codeLength += berTag.decode(is); } if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 0)) { charstring = new BerGraphicString(); codeLength += charstring.decode(is, false); return codeLength; } if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 1)) { bitstring = new BerBitString(); codeLength += bitstring.decode(is, false); return codeLength; } if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 2)) { external = new Myexternal2(); codeLength += external.decode(is, false); return codeLength; } if (passedTag != null) { return 0; } throw new IOException("Error decoding BerChoice: Tag matched to no item."); }
codeLength += charstring.encode(os, false);
private Integer32 openFile(String filename) throws ServiceError, IOException { FileOpenRequest fileOpenRequest = new FileOpenRequest(); FileName fileSpecification = new FileName(); fileSpecification.getBerGraphicString().add(new BerGraphicString(filename.getBytes())); fileOpenRequest.setFileName(fileSpecification); fileOpenRequest.setInitialPosition(new Unsigned32(0)); ConfirmedServiceRequest confirmedServiceRequest = new ConfirmedServiceRequest(); confirmedServiceRequest.setFileOpen(fileOpenRequest); ConfirmedServiceResponse confirmedServiceResponse = encodeWriteReadDecode(confirmedServiceRequest); if (confirmedServiceResponse.getFileOpen() == null) { throw new ServiceError(ServiceError.FAILED_DUE_TO_COMMUNICATIONS_CONSTRAINT, "Error decoding FileOpenResponsePdu"); } Integer32 frsmId = confirmedServiceResponse.getFileOpen().getFrsmID(); return frsmId; }
public int decode(InputStream is, BerTag berTag) throws IOException { int codeLength = 0; BerTag passedTag = berTag; if (berTag == null) { berTag = new BerTag(); codeLength += berTag.decode(is); } if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 0)) { charstring = new BerGraphicString(); codeLength += charstring.decode(is, false); return codeLength; } if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 1)) { bitstring = new BerBitString(); codeLength += bitstring.decode(is, false); return codeLength; } if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 2)) { external = new Myexternal2(); codeLength += external.decode(is, false); return codeLength; } if (passedTag != null) { return 0; } throw new IOException("Error decoding CHOICE: Tag " + berTag + " matched to no item."); }