/** * Constructs a new {@code ZipInputStream} from the specified input stream. * * @param stream * the input stream to representing a ZIP archive. */ public ZipInputStream(java.io.InputStream stream) : base(new java.io.PushbackInputStream(stream, BUF_SIZE), new Inflater(true)) { if (stream == null) { throw new java.lang.NullPointerException(); } }
/** * Creates a new <code>OctetStreamData</code>. * * @param octetStream the input stream containing the octets * @throws NullPointerException if <code>octetStream</code> is * <code>null</code> */ public OctetStreamData(java.io.InputStream octetStream) { if (octetStream == null) { throw new java.lang.NullPointerException("octetStream is null"); } this.octetStream = octetStream; }
/** * Constructs an instance for the given type element and the type found. * * @param element * the annotation type element. * @param foundType * the invalid type that was found. This is actually the textual * type description found in the binary class representation, * so it may not be human-readable. */ public AnnotationTypeMismatchException(java.lang.reflect.Method element, String foundType) : base("The annotation element, "+element+", doesn't match the type "+foundType+".") { //$NON-NLS-1$ this.elementJ = element; this.foundTypeJ = foundType; }
/// <summary> /// Write the properties to the output stream. /// </summary> /// <param name="stream">The output stream where the properties are written.</param> /// <param name="comments">Optional comments that are placed at the beginning of the output.</param> public void Write(java.io.Writer stream, String comments ) { // Create a writer to output to an ISO-8859-1 encoding (code page 28592). //StreamWriter writer = new StreamWriter( stream, System.Text.Encoding.GetEncoding( 28592 ) ); java.io.BufferedWriter writer = new java.io.BufferedWriter(stream); if( comments != null) { comments = "# " + comments; } writer.write(comments); writer.newLine(); writer.write( "# " + DateTime.Now.ToString() ); writer.newLine(); writer.flush(); for( IEnumerator e = hashtable.Keys.GetEnumerator(); e.MoveNext(); ) { String key = e.Current.ToString(); String val = hashtable[ key ].ToString(); writer.write( escapeKey( key ) + "=" + escapeValue( val ) ); writer.newLine(); writer.flush(); } }
/** * Reads all the bytes from the given input stream. * * Calls read multiple times on the given input stream until it receives an * end of file marker. Returns the combined results as a byte array. Note * that this method may block if the underlying stream read blocks. * * @param is * the input stream to be read. * @return the content of the stream as a byte array. * @throws IOException * if a read error occurs. */ public static byte[] readFullyAndClose(java.io.InputStream isJ) { // throws IOException { try { // Initial read byte[] buffer = new byte[1024]; int count = isJ.read(buffer); int nextByte = isJ.read(); // Did we get it all in one read? if (nextByte == -1) { byte[] dest = new byte[count]; java.lang.SystemJ.arraycopy(buffer, 0, dest, 0, count); return dest; } // Requires additional reads java.io.ByteArrayOutputStream baos = new java.io.ByteArrayOutputStream(count * 2); baos.write(buffer, 0, count); baos.write(nextByte); while (true) { count = isJ.read(buffer); if (count == -1) { return baos.toByteArray(); } baos.write(buffer, 0, count); } } finally { isJ.close(); } }
/** * Constructor that performs no validation. * Use <code>getInstance</code> if you want that. * * @param classToInstantiate the class to instantiate * @param paramTypes the constructor parameter types, not cloned * @param args the constructor arguments, not cloned */ public InstantiateFactory(java.lang.Class classToInstantiate, java.lang.Class[] paramTypes, Object[] args) : base() { iClassToInstantiate = classToInstantiate; iParamTypes = paramTypes; iArgs = args; findConstructor(); }
/** * Constructor that performs no validation. * Use <code>getInstance</code> if you want that. * * @param classToInstantiate the class to instantiate */ public InstantiateFactory(java.lang.Class classToInstantiate) : base() { iClassToInstantiate = classToInstantiate; iParamTypes = null; iArgs = null; findConstructor(); }
public ZOutputStream(java.io.OutputStream outJ) : base() { this.outJ=outJ; z.inflateInit(); compress=false; buf = new byte[bufsize]; }
protected internal Manifest(java.io.InputStream isJ, bool readChunks) { //throws IOException { if (readChunks) { chunks = new HashMap<String, Chunk>(); } read(isJ); }
/** * Factory method to create a typed map. * <p> * If there are any elements already in the map being decorated, they * are validated. * * @param map the map to decorate, must not be null * @param keyType the type to allow as keys, must not be null * @param valueType the type to allow as values, must not be null * @throws IllegalArgumentException if list or type is null * @throws IllegalArgumentException if the list contains invalid elements */ public static java.util.Map<Object, Object> decorate(java.util.Map<Object, Object> map, java.lang.Class keyType, java.lang.Class valueType) { return new PredicatedMap( map, InstanceofPredicate.getInstance(keyType), InstanceofPredicate.getInstance(valueType) ); }
public ZOutputStream(java.io.OutputStream outJ, int level, bool nowrap) : base() { this.outJ=outJ; z.deflateInit(level, nowrap); compress=true; buf = new byte[bufsize]; }
/** * Constructs an instance with the incomplete annotation type and the name * of the element that's missing. * * @param annotationType * the annotation type. * @param elementName * the name of the incomplete element. */ public IncompleteAnnotationException( java.lang.Class annotationType, String elementName) : base("The element, "+elementName+", is not complete for the annotation "+annotationType.getName()+".") { //$NON-NLS-1$ this.annotationTypeJ = annotationType; this.elementNameJ = elementName; }
public static Session getDefaultInstance(java.util.Properties prop) { if (null == instance) { instance = new Session (); instance.props = prop; } return instance; }
/** * Wrap an existing exception in a TransformerException. * * <p>This is used for throwing processor exceptions before * the processing has started.</p> * * @param message The error or warning message, or null to * use the message from the embedded exception. * @param e Any exception */ public TransformerException(String message, java.lang.Throwable e) : base(((message == null) || (message.length() == 0)) ? e.toString() : message) { this.containedException = e; this.locator = null; }
/** * Constructs a new {@code IllegalFormatConversionException} with the class * of the mismatched conversion and corresponding parameter. * * @param c * the class of the mismatched conversion. * @param arg * the corresponding parameter. */ public IllegalFormatConversionException(char c, java.lang.Class arg) { this.c = c; if (arg == null) { throw new java.lang.NullPointerException(); } this.arg = arg; }
/** * <p> * Constructs an instance with the bean's {@link Class} and a customizer * {@link Class}. The descriptor's {@link #getName()} is set as the * unqualified name of the <code>beanClass</code>. * </p> * * @param beanClass * The bean's Class. * @param customizerClass * The bean's customizer Class. */ public BeanDescriptor(java.lang.Class beanClass, java.lang.Class customizerClass) { if (beanClass == null) { throw new java.lang.NullPointerException(); } setName(getShortClassName(beanClass)); this.beanClass = beanClass; this.customizerClass = customizerClass; }
/** * Creates a new <code>OctetStreamData</code>. * * @param octetStream the input stream containing the octets * @param uri the URI String identifying the data object (may be * <code>null</code>) * @param mimeType the MIME type associated with the data object (may be * <code>null</code>) * @throws NullPointerException if <code>octetStream</code> is * <code>null</code> */ public OctetStreamData(java.io.InputStream octetStream, String uri, String mimeType) { if (octetStream == null) { throw new java.lang.NullPointerException("octetStream is null"); } this.octetStream = octetStream; this.uri = uri; this.mimeType = mimeType; }
public FontRenderContext(java.awt.geom.AffineTransform trans, bool antiAliased, bool usesFractionalMetrics) { if (trans != null) { transform = new java.awt.geom.AffineTransform(trans); } fAntiAliased = antiAliased; fFractionalMetrics = usesFractionalMetrics; }
public TransformAttribute(java.awt.geom.AffineTransform transform) { if (transform == null) { // awt.94=transform can not be null throw new java.lang.IllegalArgumentException("transform can not be null"); //$NON-NLS-1$ } if (!transform.isIdentity()){ this.fTransform = new java.awt.geom.AffineTransform(transform); } }
internal PackedColorModel(java.awt.color.ColorSpace space, int bits, int rmask, int gmask, int bmask, long amask, bool isAlphaPremultiplied, int trans, int transferType) : base(bits, createBits(rmask, gmask, bmask, amask), space, (amask == 0 ? false : true), isAlphaPremultiplied, trans, validateTransferType(transferType)) { //!++ TODO implement throw new java.lang.UnsupportedOperationException("Not yet implemented"); }
//throws ClassNotFoundException, IllegalAccessException, // InstantiationException /** * Creates a new instance of the specified class name * * Package private so this code is not exposed at the API level. */ internal static Object newInstance(java.lang.ClassLoader classLoader, String className) { java.lang.Class driverClass; if (classLoader == null) { driverClass = java.lang.Class.forName(className); } else { driverClass = classLoader.loadClass(className); } return driverClass.newInstance(); }
/** * Constructor that performs no validation. * Use <code>getInstance</code> if you want that. * * @param paramTypes the constructor parameter types, not cloned * @param args the constructor arguments, not cloned */ public InstantiateTransformer(java.lang.Class[] paramTypes, Object[] args) : base() { System.Type[] types = new System.Type[paramTypes.Length]; for (int i = 0; i < types.Length; i++) { types[i] = paramTypes[i].getDelegateInstance(); } iParamTypes = types; iArgs = args; }
/** * Creates a <code>DOMSignContext</code> with the specified signing key * and parent node. The signing key is stored in a * {@link KeySelector#singletonKeySelector singleton KeySelector} that is * returned by the {@link #getKeySelector getKeySelector} method. * The marshalled <code>XMLSignature</code> will be added as the last * child element of the specified parent node unless a next sibling node is * specified by invoking the {@link #setNextSibling setNextSibling} method. * * @param signingKey the signing key * @param parent the parent node * @throws NullPointerException if <code>signingKey</code> or * <code>parent</code> is <code>null</code> */ public DOMSignContext(java.security.Key signingKey, org.w3c.dom.Node parent) { if (signingKey == null) { throw new java.lang.NullPointerException("signingKey cannot be null"); } if (parent == null) { throw new java.lang.NullPointerException("parent cannot be null"); } setKeySelector(KeySelector.singletonKeySelector(signingKey)); this.parent = parent; }
internal static java.io.InputStream getResourceAsStream(java.lang.ClassLoader cl, String name) { java.io.InputStream ris; if (cl == null) { ris = java.lang.ClassLoader.getSystemResourceAsStream (name); } else { ris = cl.getResourceAsStream (name); } return ris; }
/** * Add a permission object to the permission collection. * * @param permission * the FilePermission object to add to the collection. * @throws IllegalArgumentException * if {@code permission} is not an instance of * {@code FilePermission}. * @throws IllegalStateException * if this collection is read-only. * @see java.security.PermissionCollection#add(java.security.Permission) */ public override void add(java.security.Permission permission) { if (isReadOnly()) { throw new java.lang.IllegalStateException(); } if (permission is FilePermission) { permissions.addElement(permission); } else { throw new java.lang.IllegalArgumentException(permission.toString()); } }
/** * Checks whether the calling thread is allowed to access the resource being * guarded by the specified permission object. * * @param permission * the permission to check. * @throws SecurityException * if the requested {@code permission} is denied according to * the current security policy. */ public void checkPermission(java.security.Permission permission) { try { inCheck = true; java.security.AccessController.checkPermission(permission); } finally { inCheck = false; } }
/** * Use this method only for double of float transfer types. * Extracts scaling data from the color space signature * and other tags, stored in the profile * @param pf - ICC profile */ public void loadScalingData(java.awt.color.ICC_Profile pf) { // Supposing double or float transfer type isTTypeIntegral = false; nColorChannels = pf.getNumComponents(); // Get min/max values directly from the profile // Very much like fillMinMaxValues in ICC_ColorSpace float[] maxValues = new float[nColorChannels]; float[] minValues = new float[nColorChannels]; switch (pf.getColorSpaceType()) { case java.awt.color.ColorSpace.TYPE_XYZ: minValues[0] = 0; minValues[1] = 0; minValues[2] = 0; maxValues[0] = MAX_XYZ; maxValues[1] = MAX_XYZ; maxValues[2] = MAX_XYZ; break; case java.awt.color.ColorSpace.TYPE_Lab: minValues[0] = 0; minValues[1] = -128; minValues[2] = -128; maxValues[0] = 100; maxValues[1] = 127; maxValues[2] = 127; break; default: for (int i = 0; i < nColorChannels; i++) { minValues[i] = 0; maxValues[i] = 1; } break; } channelMinValues = minValues; channelMulipliers = new float[nColorChannels]; invChannelMulipliers = new float[nColorChannels]; for (int i = 0; i < nColorChannels; i++) { channelMulipliers[i] = MAX_SHORT / (maxValues[i] - channelMinValues[i]); invChannelMulipliers[i] = (maxValues[i] - channelMinValues[i]) / MAX_SHORT; } }
// throws IOException, /** * The utility method for reading the whole input stream into a snapshot * buffer. To speed up the access it works with an underlying buffer for a * given {@link java.io.ByteArrayInputStream}. * * @param is * the stream to be read. * @return the snapshot wrapping the buffer where the bytes are read to. * @throws UnsupportedOperationException * if the input stream data cannot be exposed */ public static byte[] expose(java.io.InputStream isJ) { //UnsupportedOperationException { if (isJ is ExposedByteArrayInputStream) { return ((ExposedByteArrayInputStream) isJ).expose(); } if (isJ.GetType().Equals(typeof (java.io.ByteArrayInputStream))){ return expose((java.io.ByteArrayInputStream) isJ); } // We don't know how to do this throw new java.lang.UnsupportedOperationException(); }
public static Process exec(String[] cmdArray, String[] env, java.io.File dir) { Process p = new Process(); p.StartInfo.WorkingDirectory = (null!=dir) ? dir.toString () : SystemJ.getProperty("user.dir"); p.StartInfo.FileName = cmdArray[0]; for (int i = 0; i < env.Length; i++) { String [] keyValue = env [i].Split ('='); p.StartInfo.EnvironmentVariables.Add (keyValue[0],keyValue[1]); } for (int i = 1; i < cmdArray.Length; i++) { p.StartInfo.Arguments.Insert(i - 1, cmdArray[i]); } p.StartInfo.UseShellExecute = true; p.Start(); return p; }
public static ComponentOrientation getOrientation(java.util.ResourceBundle bdl) { Object obj = null; try { obj = bdl.getObject("Orientation"); //$NON-NLS-1$ } catch (java.util.MissingResourceException mre) { obj = null; } if (obj is ComponentOrientation) { return (ComponentOrientation) obj; } java.util.Locale locale = bdl.getLocale(); if (locale == null) { locale = java.util.Locale.getDefault(); } return getOrientation(locale); }