@Override public void retrieveRangeAgainUpdateReceived(org.ccsds.moims.mo.mal.transport.MALMessageHeader msgHeader, org.ccsds.moims.mo.mal.structures.Blob chunk, org.ccsds.moims.mo.mal.structures.UInteger indexReceived, java.util.Map qosProperties) { int index = (int) indexReceived.getValue(); Logger.getLogger(ArchiveSyncGenAdapter.class.getName()).log(Level.INFO, "Received on rerequest! Chunk index: " + index); lastTimeReceived = System.currentTimeMillis(); try { receivedChunks.add(index, chunk.getValue()); } catch (MALException ex) { Logger.getLogger(ArchiveSyncGenAdapter.class.getName()).log(Level.SEVERE, null, ex); } }
@Override public synchronized void retrieveRangeUpdateReceived(org.ccsds.moims.mo.mal.transport.MALMessageHeader msgHeader, Blob chunk, UInteger indexReceived, java.util.Map qosProperties) { int index = (int) indexReceived.getValue(); /* Logger.getLogger(ArchiveSyncAdapter.class.getName()).log(Level.INFO, "Received! Chunk index: " + index); */ lastTimeReceived = System.currentTimeMillis(); lastknowIndex = index; try { receivedChunks.add(index, chunk.getValue()); } catch (MALException ex) { Logger.getLogger(ArchiveSyncGenAdapter.class.getName()).log(Level.SEVERE, null, ex); } }
bis = new ByteArrayInputStream(obj.getValue()); ObjectInput in = null; try {
@Override public void encodeBlob(final Blob value) throws MALException { try { checkForNull(value); if (value.isURLBased()) { checkForNull(value.getURL()); } else { checkForNull(value.getValue()); } outputStream.addBytes(value.getValue()); } catch (IOException ex) { throw new MALException(ENCODING_EXCEPTION_STR, ex); } }
@Override public void encodeBlob(final Blob value) throws MALException { try { checkForNull(value); if (value.isURLBased()) { checkForNull(value.getURL()); } else { checkForNull(value.getValue()); } outputStream.addBytes(value.getValue()); } catch (IOException ex) { throw new MALException(ENCODING_EXCEPTION_STR, ex); } }
/** * Encode a blob */ @Override public void encodeBlob(final Blob value) throws MALException { byte[] byteValue = value.getValue(); encodeUInteger(new UInteger(byteValue.length)); if (value.getLength() > 0) { try { outputStream.directAdd(byteValue); } catch (IOException ex) { throw new MALException(ENCODING_EXCEPTION_STR, ex); } } }
final ByteArrayInputStream lbais = new ByteArrayInputStream(ele.getValue()); lenc = encFactory.createInputStream(lbais);
@Override public void encodeNullableBlob(final Blob value) throws MALException { try { if ((null != value) && ((value.isURLBased() && (null != value.getURL())) || (!value.isURLBased() && (null != value.getValue())))) { encodeBlob(value); } else { outputStream.addBytes((byte[]) null); } } catch (IOException ex) { throw new MALException(ENCODING_EXCEPTION_STR, ex); } }
return Arrays.toString(((Blob) in).getValue()); } catch (MALException ex) {
@Override public void encodeNullableBlob(final Blob value) throws MALException { try { if ((null != value) && ((value.isURLBased() && (null != value.getURL())) || (!value.isURLBased() && (null != value.getValue())))) { outputStream.addNotNull(); encodeBlob(value); } else { outputStream.addIsNull(); } } catch (IOException ex) { throw new MALException(ENCODING_EXCEPTION_STR, ex); } }
final BinaryDecoder binDec = new BinaryDecoder(blob.getValue()); final MALElementFactory eleFact = MALContextFactory.getElementFactoryRegistry().lookupElementFactory(binDec.decodeLong()); elem = binDec.decodeNullableElement((Element) eleFact.createElement());
@Override public void encodeNullableBlob(final Blob value) throws MALException { try { if ((null != value) && ((value.isURLBased() && (null != value.getURL())) || (!value.isURLBased() && (null != value.getValue())))) { outputStream.addNotNull(); encodeBlob(value); } else { outputStream.addIsNull(); } } catch (IOException ex) { throw new MALException(ENCODING_EXCEPTION_STR, ex); } }
/** * Decodes a single part of the message body. * * @param meel The encoded element list. * @return The decoded chunk. * @throws MALException if any error detected. */ protected Object decodeEncodedElementListBodyPart(final MALEncodedElementList meel) throws MALException { long sf = (Long) meel.getShortForm(); final MALElementFactory ef = MALContextFactory.getElementFactoryRegistry().lookupElementFactory(sf); if (null == ef) { throw new MALException("GEN transport unable to find element factory for short type: " + sf); } // create list of correct type long lsf = (-((sf) & 0xFFFFFFL)) & 0xFFFFFFL + (sf & 0xFFFFFFFFFF000000L); ElementList rv = (ElementList) MALContextFactory.getElementFactoryRegistry().lookupElementFactory(lsf).createElement(); for (MALEncodedElement ele : meel) { final ByteArrayInputStream lbais = new ByteArrayInputStream(ele.getEncodedElement().getValue()); MALElementInputStream lenc = encFactory.createInputStream(lbais); rv.add(lenc.readElement(ef.createElement(), ctx)); } return rv; }
final ByteArrayInputStream bais = new ByteArrayInputStream(body.getValue()); benc = encFactory.createInputStream(bais);