Writes an extension reference of a positive integer using FIX_EXT data types.

@param extensionType  the type
@param reference  the positive integer reference to write as the data
@throws IOException if an error occurs
172076
void writePositiveExtensionInt(int extensionType, int reference) throws IOException {
        if (reference < 0) {
            throw new IllegalArgumentException("Can only serialize positive references: " + reference);
        }
        if (reference < 0xFF) {
            output.write(FIX_EXT_1);
            output.write(extensionType);
            output.writeByte((byte) reference);
        } else if (reference < 0xFFFF) {
            output.writeByte(FIX_EXT_2);
            output.write(extensionType);
            output.writeShort((short) reference);
        } else {
            output.writeByte(FIX_EXT_4);
            output.write(extensionType);
            output.writeInt(reference);
        }
    }
695025
public void setExtensions(String extensions) throws PageException {
	if (extensions == null) return;
	this.extensions = ListUtil.toStringArrayTrim(ListUtil.listToArray(extensions, ','));
    }
938412
public void addExtension(File extensionToInstall) throws IOException {
    verifyPathIsOEX(extensionToInstall);
    createInitialDirectoryIfNecessary();

    String wuid = WUID_PREFIX + UUID.randomUUID().toString();
    // the name is guaranteed to end with .oex, enforced earlier by the verifyPathIsOEX method.
    File oexfile = File.createTempFile(OEX_PATH_PREFIX, extensionToInstall.getName(), directory);

    Files.copy(extensionToInstall, oexfile);
    writeOEXtoWidgetsDat(wuid, oexfile);
    createOEXDirectory(wuid);
  }
15867
public String add(String extension, String mimeType) {
		Mapping previous = this.map.put(extension, new Mapping(extension, mimeType));
		return (previous != null) ? previous.getMimeType() : null;
	}
1048445
public void set(String name, Object obj) throws IOException {
        if (obj instanceof Extension) {
            map.put(name, (Extension)obj);
        } else {
            throw new IOException("Unknown extension type.");
        }
    }
503972
private <T extends Assignable> T createExtension(Class<T> extensionImplClass, Archive<?> archive) {

        T extension;
        Constructor<T> extensionImplConstructor = findConstructor(extensionImplClass);

        @SuppressWarnings("unchecked")
        Class<T> constructorArg = (Class<T>) extensionImplConstructor.getParameterTypes()[0];
        try {

            if (constructorArg.isInstance(archive)) {
                extension = extensionImplConstructor.newInstance(archive);
            } else {
                extension = extensionImplConstructor.newInstance(load(constructorArg, archive));
            }
        } catch (InstantiationException e) {
            throw new ExtensionLoadingException("Failed to instantiate class of type " + archive.getClass()
                + ". The underlying class can not be abstract.", e);
        } catch (IllegalAccessException e) {
            throw new ExtensionLoadingException("Failed to instantiate class of type " + archive.getClass()
                + ". The underlying constructor is inaccessible.", e);
        } catch (InvocationTargetException e) {
            throw new ExtensionLoadingException("Failed to instantiate class of type " + archive.getClass()
                + ". The underlying constructor threw an exception.", e);
        }

        return extension;
    }
332803
private void writeTypedUInt(final int type, final long value)
    {
        if (value <= 0xFFL)
        {
            updateLength(2);
            buffer.writeUInt8(type | 0x01);
            buffer.writeUInt8(value);
        }
        else if (value <= 0xFFFFL)
        {
            updateLength(3);
            buffer.writeUInt8(type | 0x02);
            buffer.writeUInt16(value);
        }
        else if (value <= 0xFFFFFFL)
        {
            updateLength(4);
            buffer.writeUInt8(type | 0x03);
            buffer.writeUInt24(value);
        }
        else if (value <= 0xFFFFFFFFL)
        {
            updateLength(5);
            buffer.writeUInt8(type | 0x04);
            buffer.writeUInt32(value);
        }
        else if (value <= 0xFFFFFFFFFFL)
        {
            updateLength(6);
            buffer.writeUInt8(type | 0x05);
            buffer.writeUInt40(value);
        }
        else if (value <= 0xFFFFFFFFFFFFL)
        {
            updateLength(7);
            buffer.writeUInt8(type | 0x06);
            buffer.writeUInt48(value);
        }
        else if (value <= 0xFFFFFFFFFFFFFFL)
        {
            updateLength(8);
            buffer.writeUInt8(type | 0x07);
            buffer.writeUInt56(value);
        }
        else
        {
            updateLength(9);
            buffer.writeUInt8(type | 0x08);
            buffer.writeUInt64(value);
        }
    }
726647
public void setExtends(String superType) {
		if (!Strings.isEmpty(superType)
				&& !Agent.class.getName().equals(superType)) {
			JvmParameterizedTypeReference superTypeRef = newTypeRef(this.sarlAgent, superType);
			JvmTypeReference baseTypeRef = findType(this.sarlAgent, Agent.class.getCanonicalName());
			if (isSubTypeOf(this.sarlAgent, superTypeRef, baseTypeRef)) {
				this.sarlAgent.setExtends(superTypeRef);
				return;
			}
		}
		this.sarlAgent.setExtends(null);
	}
1333635
public void add(final FieldDescriptor type) {
    if (type.getJavaType() == FieldDescriptor.JavaType.MESSAGE) {
      throw new IllegalArgumentException(
        "ExtensionRegistry.add() must be provided a default instance when " +
        "adding an embedded message extension.");
    }
    add(new ExtensionInfo(type, null));
  }
386544
public void setExtends(String superType) {
		if (!Strings.isEmpty(superType)
				&& !Event.class.getName().equals(superType)) {
			JvmParameterizedTypeReference superTypeRef = newTypeRef(this.sarlEvent, superType);
			JvmTypeReference baseTypeRef = findType(this.sarlEvent, Event.class.getCanonicalName());
			if (isSubTypeOf(this.sarlEvent, superTypeRef, baseTypeRef)) {
				this.sarlEvent.setExtends(superTypeRef);
				return;
			}
		}
		this.sarlEvent.setExtends(null);
	}
1122019
public boolean recordExtendedInterface(JSTypeExpression interfaceType) {
    if (interfaceType != null && currentInfo.addExtendedInterface(interfaceType)) {
      populated = true;
      return true;
    } else {
      return false;
    }
  }
1181017
public void setExtends(String superType) {
		if (!Strings.isEmpty(superType)
				&& !Behavior.class.getName().equals(superType)) {
			JvmParameterizedTypeReference superTypeRef = newTypeRef(this.sarlBehavior, superType);
			JvmTypeReference baseTypeRef = findType(this.sarlBehavior, Behavior.class.getCanonicalName());
			if (isSubTypeOf(this.sarlBehavior, superTypeRef, baseTypeRef)) {
				this.sarlBehavior.setExtends(superTypeRef);
				return;
			}
		}
		this.sarlBehavior.setExtends(null);
	}
907207
public <T extends Assignable> String getExtensionFromExtensionMapping(final Class<T> type) {
        ExtensionWrapper extensionWrapper = extensionMappings.get(type);
        if (extensionWrapper == null) {
            loadExtensionMapping(type);
        }
        extensionWrapper = extensionMappings.get(type);
        if (extensionWrapper == null) {
            throw UnknownExtensionTypeExceptionDelegator.newExceptionInstance(type);
        }
        return extensionWrapper.getProperty("extension");
    }
24510
public void registerExtensions(final Class<?>... extensions) {
        for (Class<?> extension : extensions) {
            register(ConfigItem.Extension, extension);
        }
    }
5637
private void parseExtension(Extension ext) throws IOException {
        try {
            Class<?> extClass = OIDMap.getClass(ext.getExtensionId());
            if (extClass == null) {   // Unsupported extension
                if (ext.isCritical()) {
                    unsupportedCritExt = true;
                }
                if (map.put(ext.getExtensionId().toString(), ext) == null) {
                    return;
                } else {
                    throw new IOException("Duplicate extensions not allowed");
                }
            }
            Constructor<?> cons = extClass.getConstructor(PARAMS);

            Object[] passed = new Object[] {Boolean.valueOf(ext.isCritical()),
                    ext.getExtensionValue()};
                    CertAttrSet<?> certExt = (CertAttrSet<?>)
                            cons.newInstance(passed);
                    if (map.put(certExt.getName(), (Extension)certExt) != null) {
                        throw new IOException("Duplicate extensions not allowed");
                    }
        } catch (InvocationTargetException invk) {
            Throwable e = invk.getTargetException();
            if (ext.isCritical() == false) {
                // ignore errors parsing non-critical extensions
                if (unparseableExtensions == null) {
                    unparseableExtensions = new TreeMap<String,Extension>();
                }
                unparseableExtensions.put(ext.getExtensionId().toString(),
                        new UnparseableExtension(ext, e));
                if (debug != null) {
                    debug.println("Error parsing extension: " + ext);
                    e.printStackTrace();
                    HexDumpEncoder h = new HexDumpEncoder();
                    System.err.println(h.encodeBuffer(ext.getExtensionValue()));
                }
                return;
            }
            if (e instanceof IOException) {
                throw (IOException)e;
            } else {
                throw new IOException(e);
            }
        } catch (IOException e) {
            throw e;
        } catch (Exception e) {
            throw new IOException(e);
        }
    }
747344
protected void addCachedExtension(E extension)
    {
        if (!this.extensions.containsKey(extension.getId())) {
            // extensions
            this.extensions.put(extension.getId(), extension);

            // versions
            addCachedExtensionVersion(extension.getId().getId(), extension);
            if (!this.strictId) {
                for (String feature : extension.getFeatures()) {
                    addCachedExtensionVersion(feature, extension);
                }
            }
        }
    }
50671
public void setMimeMapping(String extension,String type)
    {
        if (_mimeMap==null)
            _mimeMap=new HashMap();
        _mimeMap.put(StringUtil.asciiToLowerCase(extension),type);
    }