Examples of TileDecoderFactory


Examples of com.lightcrafts.mediax.jai.tilecodec.TileDecoderFactory

            JaiI18N.getString("UseTileCodec1"));
        }

        TileEncoderFactory tileEncoderFactory =
            (TileEncoderFactory)registry.getFactory("tileEncoder", formatName);
        TileDecoderFactory tileDecoderFactory =
            (TileDecoderFactory)registry.getFactory("tileDecoder", formatName);
        if (tileEncoderFactory == null || tileDecoderFactory == null)
            throw new RuntimeException(JaiI18N.getString("UseTileCodec2"));

        useTileCodec = true;
View Full Code Here

Examples of com.lightcrafts.mediax.jai.tilecodec.TileDecoderFactory

       OperationRegistry registry =
           JAI.getDefaultInstance().getOperationRegistry();
       String modeName = "tileDecoder";
       String[] descriptorNames = registry.getDescriptorNames(modeName);
       TileDecoderFactory tdf = null;

       // Only non-preference NegotiableCapability objects can be added
       // to this NCS, which is ok, since these represent the capabilities
       // of the client and thus are not preferences as much as they are
       // hard capabilities (i.e. non-preferences)
       NegotiableCapabilitySet capabilities =
           new NegotiableCapabilitySet(false);

       // Note that tileEncoder capabilities cannot be added since there is
       // no way to differentiate between a encoding and a decoding capability
       // within an NCS, and since the client should only be expected to
       // decode, this should be ok.

       Iterator it;
       for (int i=0; i<descriptorNames.length; i++) {

     it = registry.getFactoryIterator(modeName, descriptorNames[i]);
     for (; it.hasNext(); ) {
         tdf = (TileDecoderFactory)it.next();
         capabilities.add(tdf.getDecodeCapability());
     }
       }

       return capabilities;
    }
View Full Code Here

Examples of com.lightcrafts.mediax.jai.tilecodec.TileDecoderFactory

  // Since "tileCodec" is the only category that we care about or honor
  // currently in the remote communication.
  NegotiableCapability codecCap = getNegotiatedValue("tileCodec");

  TileDecoderFactory tdf = null;
  TileCodecParameterList tcpl = null;

  if (codecCap != null) {

      String category = codecCap.getCategory();
      String capabilityName = codecCap.getCapabilityName();
      List generators = codecCap.getGenerators();

      Class factory;
      for (Iterator i=generators.iterator(); i.hasNext(); ) {
    factory = (Class)i.next();
    if (tdf == null &&
        TileDecoderFactory.class.isAssignableFrom(factory)) {

        try {
      tdf = (TileDecoderFactory)factory.newInstance();
        } catch (InstantiationException ie) {
      throw new RemoteImagingException(ImageUtil.getStackTraceString(ie));
        } catch (IllegalAccessException iae) {
      throw new RemoteImagingException(ImageUtil.getStackTraceString(iae));
        }
    }
      }

      if (tdf == null) {
    throw new RemoteImagingException(
             JaiI18N.getString("RMIServerProxy0"));
      }

      TileCodecDescriptor tcd =
    (TileCodecDescriptor)registry.getDescriptor("tileDecoder",
                  capabilityName);

      if (tcd.includesSampleModelInfo() == false ||
    tcd.includesLocationInfo() == false) {
    throw new RemoteImagingException(
             JaiI18N.getString("RMIServerProxy1"));
      }

      ParameterListDescriptor pld =
    tcd.getParameterListDescriptor("tileDecoder");

      tcpl = new TileCodecParameterList(capabilityName,
                new String[] {"tileDecoder"},
                pld);

      // Set parameters on TileCodecParameterList only if there are any
      // parameters defined.
      if (pld != null) {

    String paramNames[] = pld.getParamNames();
    String currParam;
    Object currValue;
    if (paramNames != null) {
        for (int i=0; i<paramNames.length; i++) {
      currParam = paramNames[i];
      try {
          currValue = codecCap.getNegotiatedValue(currParam);
      } catch (IllegalArgumentException iae) {
          // If this parameter is not defined on the
          // NegotiableCapability, then move onto the next
          continue;
      }

      tcpl.setParameter(currParam, currValue);
        }
    }
      }
  }

  try {
      // If a compression hint was set, use it
      if (codecCap != null) {
    byte ctile[] = remoteImage.getCompressedTile(id,
                   tileX,
                   tileY);
    ByteArrayInputStream stream = new ByteArrayInputStream(ctile);
    TileDecoder decoder = tdf.createDecoder(stream, tcpl);
    try {
        return decoder.decode();
    } catch (java.io.IOException ioe) {
        throw new RemoteImagingException(ImageUtil.getStackTraceString(ioe));
    }
View Full Code Here

Examples of javax.media.jai.tilecodec.TileDecoderFactory

  // Since "tileCodec" is the only category that we care about or honor
  // currently in the remote communication.
  NegotiableCapability codecCap = getNegotiatedValue("tileCodec");

  TileDecoderFactory tdf = null;
  TileCodecParameterList tcpl = null;

  if (codecCap != null) {

      String category = codecCap.getCategory();
      String capabilityName = codecCap.getCapabilityName();
      List generators = codecCap.getGenerators();

      Class factory;
      for (Iterator i=generators.iterator(); i.hasNext(); ) {
    factory = (Class)i.next();
    if (tdf == null &&
        TileDecoderFactory.class.isAssignableFrom(factory)) {

        try {
      tdf = (TileDecoderFactory)factory.newInstance();
        } catch (InstantiationException ie) {
      throw new RemoteImagingException(ImageUtil.getStackTraceString(ie));
        } catch (IllegalAccessException iae) {
      throw new RemoteImagingException(ImageUtil.getStackTraceString(iae));
        }
    }
      }

      if (tdf == null) {
    throw new RemoteImagingException(
             JaiI18N.getString("RMIServerProxy0"));
      }

      TileCodecDescriptor tcd =
    (TileCodecDescriptor)registry.getDescriptor("tileDecoder",
                  capabilityName);

      if (tcd.includesSampleModelInfo() == false ||
    tcd.includesLocationInfo() == false) {
    throw new RemoteImagingException(
             JaiI18N.getString("RMIServerProxy1"));
      }

      ParameterListDescriptor pld =
    tcd.getParameterListDescriptor("tileDecoder");

      tcpl = new TileCodecParameterList(capabilityName,
                new String[] {"tileDecoder"},
                pld);

      // Set parameters on TileCodecParameterList only if there are any
      // parameters defined.
      if (pld != null) {

    String paramNames[] = pld.getParamNames();
    String currParam;
    Object currValue;
    if (paramNames != null) {
        for (int i=0; i<paramNames.length; i++) {
      currParam = paramNames[i];
      try {
          currValue = codecCap.getNegotiatedValue(currParam);
      } catch (IllegalArgumentException iae) {
          // If this parameter is not defined on the
          // NegotiableCapability, then move onto the next
          continue;
      }

      tcpl.setParameter(currParam, currValue);
        }
    }
      }
  }

  try {
      // If a compression hint was set, use it
      if (codecCap != null) {
    byte ctile[] = remoteImage.getCompressedTile(id,
                   tileX,
                   tileY);
    ByteArrayInputStream stream = new ByteArrayInputStream(ctile);
    TileDecoder decoder = tdf.createDecoder(stream, tcpl);
    try {
        return decoder.decode();
    } catch (java.io.IOException ioe) {
        throw new RemoteImagingException(ImageUtil.getStackTraceString(ioe));
    }
View Full Code Here

Examples of javax.media.jai.tilecodec.TileDecoderFactory

            JaiI18N.getString("UseTileCodec1"));
        }

        TileEncoderFactory tileEncoderFactory =
            (TileEncoderFactory)registry.getFactory("tileEncoder", formatName);
        TileDecoderFactory tileDecoderFactory =
            (TileDecoderFactory)registry.getFactory("tileDecoder", formatName);
        if (tileEncoderFactory == null || tileDecoderFactory == null)
            throw new RuntimeException(JaiI18N.getString("UseTileCodec2"));

        useTileCodec = true;
View Full Code Here

Examples of javax.media.jai.tilecodec.TileDecoderFactory

       OperationRegistry registry =
           JAI.getDefaultInstance().getOperationRegistry();
       String modeName = "tileDecoder";
       String[] descriptorNames = registry.getDescriptorNames(modeName);
       TileDecoderFactory tdf = null;

       // Only non-preference NegotiableCapability objects can be added
       // to this NCS, which is ok, since these represent the capabilities
       // of the client and thus are not preferences as much as they are
       // hard capabilities (i.e. non-preferences)
       NegotiableCapabilitySet capabilities =
           new NegotiableCapabilitySet(false);

       // Note that tileEncoder capabilities cannot be added since there is
       // no way to differentiate between a encoding and a decoding capability
       // within an NCS, and since the client should only be expected to
       // decode, this should be ok.

       Iterator it;
       for (int i=0; i<descriptorNames.length; i++) {

     it = registry.getFactoryIterator(modeName, descriptorNames[i]);
     for (; it.hasNext(); ) {
         tdf = (TileDecoderFactory)it.next();
         capabilities.add(tdf.getDecodeCapability());
     }
       }

       return capabilities;
    }
View Full Code Here

Examples of javax.media.jai.tilecodec.TileDecoderFactory

/*  844 */       return null;
/*      */     }
/*      */
/*  849 */     NegotiableCapability codecCap = getNegotiatedValue("tileCodec");
/*      */
/*  851 */     TileDecoderFactory tdf = null;
/*  852 */     TileCodecParameterList tcpl = null;
/*      */
/*  854 */     if (codecCap != null)
/*      */     {
/*  856 */       String category = codecCap.getCategory();
/*  857 */       String capabilityName = codecCap.getCapabilityName();
/*  858 */       List generators = codecCap.getGenerators();
/*      */
/*  861 */       for (Iterator i = generators.iterator(); i.hasNext(); ) {
/*  862 */         Class factory = (Class)i.next();
/*  863 */         if ((tdf == null) && (TileDecoderFactory.class.isAssignableFrom(factory)))
/*      */         {
/*      */           try
/*      */           {
/*  867 */             tdf = (TileDecoderFactory)factory.newInstance();
/*      */           } catch (InstantiationException ie) {
/*  869 */             throw new RemoteImagingException(ImageUtil.getStackTraceString(ie));
/*      */           } catch (IllegalAccessException iae) {
/*  871 */             throw new RemoteImagingException(ImageUtil.getStackTraceString(iae));
/*      */           }
/*      */         }
/*      */       }
/*      */
/*  876 */       if (tdf == null) {
/*  877 */         throw new RemoteImagingException(JaiI18N.getString("RMIServerProxy0"));
/*      */       }
/*      */
/*  881 */       TileCodecDescriptor tcd = (TileCodecDescriptor)this.registry.getDescriptor("tileDecoder", capabilityName);
/*      */
/*  885 */       if ((!tcd.includesSampleModelInfo()) || (!tcd.includesLocationInfo()))
/*      */       {
/*  887 */         throw new RemoteImagingException(JaiI18N.getString("RMIServerProxy1"));
/*      */       }
/*      */
/*  891 */       ParameterListDescriptor pld = tcd.getParameterListDescriptor("tileDecoder");
/*      */
/*  894 */       tcpl = new TileCodecParameterList(capabilityName, new String[] { "tileDecoder" }, pld);
/*      */
/*  900 */       if (pld != null)
/*      */       {
/*  902 */         String[] paramNames = pld.getParamNames();
/*      */
/*  905 */         if (paramNames != null) {
/*  906 */           for (int i = 0; i < paramNames.length; i++) { String currParam = paramNames[i];
/*      */             Object currValue;
/*      */             try { currValue = codecCap.getNegotiatedValue(currParam); }
/*      */             catch (IllegalArgumentException iae)
/*      */             {
/*  913 */               continue;
/*      */             }
/*      */
/*  916 */             tcpl.setParameter(currParam, currValue);
/*      */           }
/*      */         }
/*      */       }
/*      */     }
/*      */
/*      */     try
/*      */     {
/*  924 */       if (codecCap != null) {
/*  925 */         byte[] ctile = this.remoteImage.getCompressedTile(this.id, tileX, tileY);
/*      */
/*  928 */         ByteArrayInputStream stream = new ByteArrayInputStream(ctile);
/*  929 */         TileDecoder decoder = tdf.createDecoder(stream, tcpl);
/*      */         try {
/*  931 */           return decoder.decode();
/*      */         } catch (IOException ioe) {
/*  933 */           throw new RemoteImagingException(ImageUtil.getStackTraceString(ioe));
/*      */         }
View Full Code Here

Examples of javax.media.jai.tilecodec.TileDecoderFactory

/*     */   {
/* 466 */     OperationRegistry registry = JAI.getDefaultInstance().getOperationRegistry();
/*     */
/* 468 */     String modeName = "tileDecoder";
/* 469 */     String[] descriptorNames = registry.getDescriptorNames(modeName);
/* 470 */     TileDecoderFactory tdf = null;
/*     */
/* 476 */     NegotiableCapabilitySet capabilities = new NegotiableCapabilitySet(false);
/*     */
/* 485 */     for (int i = 0; i < descriptorNames.length; i++)
/*     */     {
/* 487 */       Iterator it = registry.getFactoryIterator(modeName, descriptorNames[i]);
/* 488 */       while (it.hasNext()) {
/* 489 */         tdf = (TileDecoderFactory)it.next();
/* 490 */         capabilities.add(tdf.getDecodeCapability());
/*     */       }
/*     */     }
/*     */
/* 494 */     return capabilities;
/*     */   }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.