/**
   * Constructs a {@code MemoryCacheImageInputStream} that will read from a given {@code
   * InputStream}.
   *
   * @param stream an {@code InputStream} to read from.
   * @exception IllegalArgumentException if {@code stream} is {@code null}.
   */
  public MemoryCacheImageInputStream(InputStream stream) {
    if (stream == null) {
      throw new IllegalArgumentException("stream == null!");
    }
    this.stream = stream;

    disposerRecord = new StreamDisposerRecord(cache);
    if (getClass() == MemoryCacheImageInputStream.class) {
      disposerReferent = new Object();
      Disposer.addRecord(disposerReferent, disposerRecord);
    } else {
      disposerReferent = new StreamFinalizer(this);
    }
  }
Ejemplo n.º 2
0
  /**
   * Constructs a <code>FileImageInputStream</code> that will read from a given <code>
   * RandomAccessFile</code>.
   *
   * <p>The file contents must not change between the time this object is constructed and the time
   * of the last call to a read method.
   *
   * @param raf a <code>RandomAccessFile</code> to read from.
   * @exception IllegalArgumentException if <code>raf</code> is <code>null</code>.
   */
  public FileImageInputStream(RandomAccessFile raf) {
    if (raf == null) {
      throw new IllegalArgumentException("raf == null!");
    }
    this.raf = raf;

    disposerRecord = new CloseableDisposerRecord(raf);
    if (getClass() == FileImageInputStream.class) {
      disposerReferent = new Object();
      Disposer.addRecord(disposerReferent, disposerRecord);
    } else {
      disposerReferent = new StreamFinalizer(this);
    }
  }
Ejemplo n.º 3
0
 /*     */ public static FontScaler getScaler(
     Font2D paramFont2D, int paramInt1, boolean paramBoolean, int paramInt2)
       /*     */ {
   /* 123 */ FontScaler localFontScaler = null;
   /*     */ try
   /*     */ {
     /* 126 */ Object[] arrayOfObject = {
       paramFont2D,
       Integer.valueOf(paramInt1),
       Boolean.valueOf(paramBoolean),
       Integer.valueOf(paramInt2)
     };
     /*     */
     /* 128 */ localFontScaler = (FontScaler) scalerConstructor.newInstance(arrayOfObject);
     /* 129 */ Disposer.addObjectRecord(paramFont2D, localFontScaler);
     /*     */ } catch (Throwable localThrowable) {
     /* 131 */ localFontScaler = nullScaler;
     /*     */
     /* 136 */ FontManager localFontManager = FontManagerFactory.getInstance();
     /* 137 */ localFontManager.deRegisterBadFont(paramFont2D);
     /*     */ }
   /* 139 */ return localFontScaler;
   /*     */ }