org.eclipse.mylyn.commons.core_3.7.1.v20120425-0100

16:46:21.993 INFO  jd.cli.Main - Decompiling org.eclipse.mylyn.commons.core_3.7.1.v20120425-0100.jar
package org.eclipse.mylyn.commons.core.io;

class Policy
{
  public static final boolean DEBUG_STREAMS = false;
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.commons.core.io.Policy
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.commons.core.io;

import java.io.FilterInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InterruptedIOException;
import org.eclipse.core.runtime.IProgressMonitor;

public abstract class ProgressMonitorInputStream
  extends FilterInputStream
{
  private final IProgressMonitor monitor;
  private final int updateIncrement;
  private final long bytesTotal;
  private long bytesRead = 0L;
  private long lastUpdate = -1L;
  private long nextUpdate = 0L;
  
  public ProgressMonitorInputStream(InputStream in, long bytesTotal, int updateIncrement, IProgressMonitor monitor)
  {
    super(in);
    this.bytesTotal = bytesTotal;
    this.updateIncrement = updateIncrement;
    this.monitor = monitor;
    update(true);
  }
  
  protected abstract void updateMonitor(long paramLong1, long paramLong2, IProgressMonitor paramIProgressMonitor);
  
  /* Error */
  public void close()
    throws IOException
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 75	org/eclipse/mylyn/commons/core/io/ProgressMonitorInputStream:in	Ljava/io/InputStream;
    //   4: invokevirtual 79	java/io/InputStream:close	()V
    //   7: goto +11 -> 18
    //   10: astore_1
    //   11: aload_0
    //   12: iconst_1
    //   13: invokespecial 82	org/eclipse/mylyn/commons/core/io/ProgressMonitorInputStream:update	(Z)V
    //   16: aload_1
    //   17: athrow
    //   18: aload_0
    //   19: iconst_1
    //   20: invokespecial 82	org/eclipse/mylyn/commons/core/io/ProgressMonitorInputStream:update	(Z)V
    //   23: return
    // Line number table:
    //   Java source line #74	-> byte code offset #0
    //   Java source line #75	-> byte code offset #10
    //   Java source line #76	-> byte code offset #11
    //   Java source line #77	-> byte code offset #16
    //   Java source line #76	-> byte code offset #18
    //   Java source line #78	-> byte code offset #23
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	24	0	this	ProgressMonitorInputStream
    //   10	7	1	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   0	10	10	finally
  }
  
  public int read()
    throws IOException
  {
    int b = in.read();
    if (b != -1)
    {
      bytesRead += 1L;
      update(false);
    }
    return b;
  }
  
  public int read(byte[] buffer, int offset, int length)
    throws IOException
  {
    try
    {
      int count = in.read(buffer, offset, length);
      if (count != -1)
      {
        bytesRead += count;
        update(false);
      }
      return count;
    }
    catch (InterruptedIOException e)
    {
      bytesRead += bytesTransferred;
      update(false);
      throw e;
    }
  }
  
  public long skip(long amount)
    throws IOException
  {
    try
    {
      long count = in.skip(amount);
      bytesRead += count;
      update(false);
      return count;
    }
    catch (InterruptedIOException e)
    {
      bytesRead += bytesTransferred;
      update(false);
      throw e;
    }
  }
  
  public boolean markSupported()
  {
    return false;
  }
  
  private void update(boolean now)
  {
    if ((bytesRead >= nextUpdate) || (now))
    {
      nextUpdate = (bytesRead - bytesRead % updateIncrement);
      if (nextUpdate != lastUpdate) {
        updateMonitor(nextUpdate, bytesTotal, monitor);
      }
      lastUpdate = nextUpdate;
      nextUpdate += updateIncrement;
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.commons.core.io.ProgressMonitorInputStream
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.commons.core.io;

import java.io.FilterInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InterruptedIOException;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import org.eclipse.mylyn.commons.core.operations.OperationUtil;

public class TimeoutInputStream
  extends FilterInputStream
{
  private final long readTimeout;
  private final long closeTimeout;
  private boolean closeRequested = false;
  private final Future<?> future;
  private byte[] iobuffer;
  private int head = 0;
  private int length = 0;
  private IOException ioe = null;
  private boolean waitingForClose = false;
  private boolean growWhenFull = false;
  private final CountDownLatch closeLatch = new CountDownLatch(1);
  
  public TimeoutInputStream(InputStream in, int bufferSize, long readTimeout, long closeTimeout)
  {
    super(in);
    this.readTimeout = readTimeout;
    this.closeTimeout = closeTimeout;
    iobuffer = new byte[bufferSize];
    future = OperationUtil.getExecutorService().submit(new Runnable()
    {
      public void run()
      {
        TimeoutInputStream.this.runThread();
      }
    });
  }
  
  public TimeoutInputStream(InputStream in, int bufferSize, long readTimeout, long closeTimeout, boolean growWhenFull)
  {
    this(in, bufferSize, readTimeout, closeTimeout);
    this.growWhenFull = growWhenFull;
  }
  
  public void close()
    throws IOException
  {
    if (closeLatch.getCount() == 0L) {
      return;
    }
    synchronized (this)
    {
      closeRequested = true;
      
      future.cancel(true);
      checkError();
    }
    if (closeTimeout == -1L) {
      return;
    }
    boolean closed = false;
    try
    {
      closed = closeLatch.await(closeTimeout, TimeUnit.MILLISECONDS);
    }
    catch (InterruptedException localInterruptedException)
    {
      Thread.currentThread().interrupt();
    }
    synchronized (this)
    {
      checkError();
      if (!closed) {
        throw new InterruptedIOException();
      }
    }
  }
  
  public synchronized int available()
    throws IOException
  {
    if (length == 0) {
      checkError();
    }
    return length > 0 ? length : 0;
  }
  
  public synchronized int read()
    throws IOException
  {
    if (!syncFill()) {
      return -1;
    }
    int b = iobuffer[(head++)] & 0xFF;
    if (head == iobuffer.length) {
      head = 0;
    }
    length -= 1;
    notify();
    return b;
  }
  
  public synchronized int read(byte[] buffer, int off, int len)
    throws IOException
  {
    if (!syncFill()) {
      return -1;
    }
    int pos = off;
    if (len > length) {
      len = length;
    }
    while (len-- > 0)
    {
      buffer[(pos++)] = iobuffer[(head++)];
      if (head == iobuffer.length) {
        head = 0;
      }
      length -= 1;
    }
    notify();
    return pos - off;
  }
  
  public synchronized long skip(long count)
    throws IOException
  {
    long amount = 0L;
    try
    {
      do
      {
        if (!syncFill()) {
          break;
        }
        int skip = (int)Math.min(count - amount, length);
        head = ((head + skip) % iobuffer.length);
        length -= skip;
        amount += skip;
      } while (amount < count);
    }
    catch (InterruptedIOException e)
    {
      bytesTransferred = ((int)amount);
      throw e;
    }
    notify();
    return amount;
  }
  
  public boolean markSupported()
  {
    return false;
  }
  
  private boolean syncFill()
    throws IOException
  {
    if (length != 0) {
      return true;
    }
    checkError();
    if (waitingForClose) {
      return false;
    }
    notify();
    try
    {
      wait(readTimeout);
    }
    catch (InterruptedException localInterruptedException)
    {
      Thread.currentThread().interrupt();
    }
    if (length != 0) {
      return true;
    }
    checkError();
    if (waitingForClose) {
      return false;
    }
    throw new InterruptedIOException();
  }
  
  private void checkError()
    throws IOException
  {
    if (ioe != null)
    {
      IOException e = ioe;
      ioe = null;
      throw e;
    }
  }
  
  /* Error */
  private void runThread()
  {
    // Byte code:
    //   0: aload_0
    //   1: invokespecial 187	org/eclipse/mylyn/commons/core/io/TimeoutInputStream:readUntilDone	()V
    //   4: goto +159 -> 163
    //   7: astore_1
    //   8: aload_0
    //   9: dup
    //   10: astore_2
    //   11: monitorenter
    //   12: aload_0
    //   13: aload_1
    //   14: putfield 167	org/eclipse/mylyn/commons/core/io/TimeoutInputStream:ioe	Ljava/io/IOException;
    //   17: aload_2
    //   18: monitorexit
    //   19: goto +6 -> 25
    //   22: aload_2
    //   23: monitorexit
    //   24: athrow
    //   25: aload_0
    //   26: invokespecial 190	org/eclipse/mylyn/commons/core/io/TimeoutInputStream:waitUntilClosed	()V
    //   29: aload_0
    //   30: getfield 168	org/eclipse/mylyn/commons/core/io/TimeoutInputStream:in	Ljava/io/InputStream;
    //   33: invokevirtual 172	java/io/InputStream:close	()V
    //   36: goto +48 -> 84
    //   39: astore 4
    //   41: aload_0
    //   42: dup
    //   43: astore 5
    //   45: monitorenter
    //   46: aload_0
    //   47: aload 4
    //   49: putfield 167	org/eclipse/mylyn/commons/core/io/TimeoutInputStream:ioe	Ljava/io/IOException;
    //   52: aload 5
    //   54: monitorexit
    //   55: goto +7 -> 62
    //   58: aload 5
    //   60: monitorexit
    //   61: athrow
    //   62: aload_0
    //   63: getfield 169	org/eclipse/mylyn/commons/core/io/TimeoutInputStream:closeLatch	Ljava/util/concurrent/CountDownLatch;
    //   66: invokevirtual 182	java/util/concurrent/CountDownLatch:countDown	()V
    //   69: goto +160 -> 229
    //   72: astore 6
    //   74: aload_0
    //   75: getfield 169	org/eclipse/mylyn/commons/core/io/TimeoutInputStream:closeLatch	Ljava/util/concurrent/CountDownLatch;
    //   78: invokevirtual 182	java/util/concurrent/CountDownLatch:countDown	()V
    //   81: aload 6
    //   83: athrow
    //   84: aload_0
    //   85: getfield 169	org/eclipse/mylyn/commons/core/io/TimeoutInputStream:closeLatch	Ljava/util/concurrent/CountDownLatch;
    //   88: invokevirtual 182	java/util/concurrent/CountDownLatch:countDown	()V
    //   91: goto +138 -> 229
    //   94: astore_3
    //   95: aload_0
    //   96: invokespecial 190	org/eclipse/mylyn/commons/core/io/TimeoutInputStream:waitUntilClosed	()V
    //   99: aload_0
    //   100: getfield 168	org/eclipse/mylyn/commons/core/io/TimeoutInputStream:in	Ljava/io/InputStream;
    //   103: invokevirtual 172	java/io/InputStream:close	()V
    //   106: goto +48 -> 154
    //   109: astore 4
    //   111: aload_0
    //   112: dup
    //   113: astore 5
    //   115: monitorenter
    //   116: aload_0
    //   117: aload 4
    //   119: putfield 167	org/eclipse/mylyn/commons/core/io/TimeoutInputStream:ioe	Ljava/io/IOException;
    //   122: aload 5
    //   124: monitorexit
    //   125: goto +7 -> 132
    //   128: aload 5
    //   130: monitorexit
    //   131: athrow
    //   132: aload_0
    //   133: getfield 169	org/eclipse/mylyn/commons/core/io/TimeoutInputStream:closeLatch	Ljava/util/concurrent/CountDownLatch;
    //   136: invokevirtual 182	java/util/concurrent/CountDownLatch:countDown	()V
    //   139: goto +22 -> 161
    //   142: astore 6
    //   144: aload_0
    //   145: getfield 169	org/eclipse/mylyn/commons/core/io/TimeoutInputStream:closeLatch	Ljava/util/concurrent/CountDownLatch;
    //   148: invokevirtual 182	java/util/concurrent/CountDownLatch:countDown	()V
    //   151: aload 6
    //   153: athrow
    //   154: aload_0
    //   155: getfield 169	org/eclipse/mylyn/commons/core/io/TimeoutInputStream:closeLatch	Ljava/util/concurrent/CountDownLatch;
    //   158: invokevirtual 182	java/util/concurrent/CountDownLatch:countDown	()V
    //   161: aload_3
    //   162: athrow
    //   163: aload_0
    //   164: invokespecial 190	org/eclipse/mylyn/commons/core/io/TimeoutInputStream:waitUntilClosed	()V
    //   167: aload_0
    //   168: getfield 168	org/eclipse/mylyn/commons/core/io/TimeoutInputStream:in	Ljava/io/InputStream;
    //   171: invokevirtual 172	java/io/InputStream:close	()V
    //   174: goto +48 -> 222
    //   177: astore 4
    //   179: aload_0
    //   180: dup
    //   181: astore 5
    //   183: monitorenter
    //   184: aload_0
    //   185: aload 4
    //   187: putfield 167	org/eclipse/mylyn/commons/core/io/TimeoutInputStream:ioe	Ljava/io/IOException;
    //   190: aload 5
    //   192: monitorexit
    //   193: goto +7 -> 200
    //   196: aload 5
    //   198: monitorexit
    //   199: athrow
    //   200: aload_0
    //   201: getfield 169	org/eclipse/mylyn/commons/core/io/TimeoutInputStream:closeLatch	Ljava/util/concurrent/CountDownLatch;
    //   204: invokevirtual 182	java/util/concurrent/CountDownLatch:countDown	()V
    //   207: goto +22 -> 229
    //   210: astore 6
    //   212: aload_0
    //   213: getfield 169	org/eclipse/mylyn/commons/core/io/TimeoutInputStream:closeLatch	Ljava/util/concurrent/CountDownLatch;
    //   216: invokevirtual 182	java/util/concurrent/CountDownLatch:countDown	()V
    //   219: aload 6
    //   221: athrow
    //   222: aload_0
    //   223: getfield 169	org/eclipse/mylyn/commons/core/io/TimeoutInputStream:closeLatch	Ljava/util/concurrent/CountDownLatch;
    //   226: invokevirtual 182	java/util/concurrent/CountDownLatch:countDown	()V
    //   229: return
    // Line number table:
    //   Java source line #278	-> byte code offset #0
    //   Java source line #279	-> byte code offset #7
    //   Java source line #280	-> byte code offset #8
    //   Java source line #281	-> byte code offset #12
    //   Java source line #280	-> byte code offset #17
    //   Java source line #284	-> byte code offset #25
    //   Java source line #286	-> byte code offset #29
    //   Java source line #287	-> byte code offset #39
    //   Java source line #288	-> byte code offset #41
    //   Java source line #289	-> byte code offset #46
    //   Java source line #288	-> byte code offset #52
    //   Java source line #292	-> byte code offset #62
    //   Java source line #291	-> byte code offset #72
    //   Java source line #292	-> byte code offset #74
    //   Java source line #293	-> byte code offset #81
    //   Java source line #292	-> byte code offset #84
    //   Java source line #293	-> byte code offset #91
    //   Java source line #283	-> byte code offset #94
    //   Java source line #284	-> byte code offset #95
    //   Java source line #286	-> byte code offset #99
    //   Java source line #287	-> byte code offset #109
    //   Java source line #288	-> byte code offset #111
    //   Java source line #289	-> byte code offset #116
    //   Java source line #288	-> byte code offset #122
    //   Java source line #292	-> byte code offset #132
    //   Java source line #291	-> byte code offset #142
    //   Java source line #292	-> byte code offset #144
    //   Java source line #293	-> byte code offset #151
    //   Java source line #292	-> byte code offset #154
    //   Java source line #294	-> byte code offset #161
    //   Java source line #284	-> byte code offset #163
    //   Java source line #286	-> byte code offset #167
    //   Java source line #287	-> byte code offset #177
    //   Java source line #288	-> byte code offset #179
    //   Java source line #289	-> byte code offset #184
    //   Java source line #288	-> byte code offset #190
    //   Java source line #292	-> byte code offset #200
    //   Java source line #291	-> byte code offset #210
    //   Java source line #292	-> byte code offset #212
    //   Java source line #293	-> byte code offset #219
    //   Java source line #292	-> byte code offset #222
    //   Java source line #295	-> byte code offset #229
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	230	0	this	TimeoutInputStream
    //   7	7	1	e	IOException
    //   10	13	2	Ljava/lang/Object;	Object
    //   94	68	3	localObject1	Object
    //   39	9	4	e	IOException
    //   109	9	4	e	IOException
    //   177	9	4	e	IOException
    //   43	16	5	Ljava/lang/Object;	Object
    //   113	16	5	Ljava/lang/Object;	Object
    //   181	16	5	Ljava/lang/Object;	Object
    //   72	10	6	localObject2	Object
    //   142	10	6	localObject3	Object
    //   210	10	6	localObject4	Object
    // Exception table:
    //   from	to	target	type
    //   0	4	7	java/io/IOException
    //   12	19	22	finally
    //   22	24	22	finally
    //   29	36	39	java/io/IOException
    //   46	55	58	finally
    //   58	61	58	finally
    //   29	62	72	finally
    //   0	25	94	finally
    //   99	106	109	java/io/IOException
    //   116	125	128	finally
    //   128	131	128	finally
    //   99	132	142	finally
    //   167	174	177	java/io/IOException
    //   184	193	196	finally
    //   196	199	196	finally
    //   167	200	210	finally
  }
  
  private synchronized void waitUntilClosed()
  {
    waitingForClose = true;
    notify();
    while (!closeRequested) {
      try
      {
        wait();
      }
      catch (InterruptedException localInterruptedException)
      {
        closeRequested = true;
      }
    }
  }
  
  private void readUntilDone()
    throws IOException
  {
    while (!closeRequested)
    {
      int len;
      synchronized (this)
      {
        while (isBufferFull())
        {
          if (closeRequested) {
            return;
          }
          waitForRead();
        }
        int off = (head + length) % iobuffer.length;
        len = (head > off ? head : iobuffer.length) - off;
      }
      try
      {
        int len;
        int off;
        int count = in.read(iobuffer, off, len);
        if (count == -1) {
          return;
        }
      }
      catch (InterruptedIOException e)
      {
        int count = bytesTransferred;
        synchronized (this)
        {
          length += count;
          notify();
        }
      }
    }
  }
  
  private synchronized void waitForRead()
  {
    try
    {
      if (growWhenFull) {
        wait(readTimeout);
      } else {
        wait();
      }
    }
    catch (InterruptedException localInterruptedException)
    {
      closeRequested = true;
    }
    if ((growWhenFull) && (isBufferFull())) {
      growBuffer();
    }
  }
  
  private synchronized void growBuffer()
  {
    int newSize = 2 * iobuffer.length;
    if (newSize > iobuffer.length)
    {
      byte[] newBuffer = new byte[newSize];
      int pos = 0;
      int len = length;
      while (len-- > 0)
      {
        newBuffer[(pos++)] = iobuffer[(head++)];
        if (head == iobuffer.length) {
          head = 0;
        }
      }
      iobuffer = newBuffer;
      head = 0;
    }
  }
  
  private boolean isBufferFull()
  {
    return length == iobuffer.length;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.commons.core.io.TimeoutInputStream
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.commons.core.io;

import java.io.BufferedOutputStream;
import java.io.FilterOutputStream;
import java.io.IOException;
import java.io.InterruptedIOException;
import java.io.OutputStream;

public class TimeoutOutputStream
  extends FilterOutputStream
{
  private final long writeTimeout;
  private final long closeTimeout;
  private final byte[] iobuffer;
  private int head = 0;
  private int length = 0;
  private boolean closeRequested = false;
  private boolean flushRequested = false;
  private Thread thread;
  private boolean waitingForClose = false;
  private IOException ioe = null;
  
  public TimeoutOutputStream(OutputStream out, int bufferSize, long writeTimeout, long closeTimeout)
  {
    super(new BufferedOutputStream(out, bufferSize));
    this.writeTimeout = writeTimeout;
    this.closeTimeout = closeTimeout;
    iobuffer = new byte[bufferSize];
    thread = new Thread(new Runnable()
    {
      public void run()
      {
        TimeoutOutputStream.this.runThread();
      }
    }, "TimeoutOutputStream");
    thread.setDaemon(true);
    thread.start();
  }
  
  public void close()
    throws IOException
  {
    synchronized (this)
    {
      if (thread == null) {
        return;
      }
      Thread oldThread = thread;
      closeRequested = true;
      thread.interrupt();
      checkError();
    }
    Thread oldThread;
    if (closeTimeout == -1L) {
      return;
    }
    try
    {
      oldThread.join(closeTimeout);
    }
    catch (InterruptedException localInterruptedException)
    {
      Thread.currentThread().interrupt();
    }
    synchronized (this)
    {
      checkError();
      if (thread != null) {
        throw new InterruptedIOException();
      }
    }
  }
  
  public synchronized void write(int b)
    throws IOException
  {
    syncCommit(true);
    iobuffer[((head + length) % iobuffer.length)] = ((byte)b);
    length += 1;
    notify();
  }
  
  public synchronized void write(byte[] buffer, int off, int len)
    throws IOException
  {
    int amount = 0;
    try
    {
      do
      {
        syncCommit(true);
        while ((amount < len) && (length != iobuffer.length))
        {
          iobuffer[((head + length) % iobuffer.length)] = buffer[(off++)];
          length += 1;
          amount++;
        }
      } while (amount < len);
    }
    catch (InterruptedIOException e)
    {
      bytesTransferred = amount;
      throw e;
    }
    notify();
  }
  
  public synchronized void flush()
    throws IOException
  {
    int oldLength = length;
    flushRequested = true;
    try
    {
      syncCommit(false);
    }
    catch (InterruptedIOException e)
    {
      bytesTransferred = (oldLength - length);
      throw e;
    }
    notify();
  }
  
  private void syncCommit(boolean partial)
    throws IOException
  {
    checkError();
    if (((partial) && (length != iobuffer.length)) || (length == 0)) {
      return;
    }
    if (waitingForClose) {
      throw new IOException(Messages.TimeoutOutputStream_cannotWriteToStream);
    }
    notify();
    try
    {
      wait(writeTimeout);
    }
    catch (InterruptedException localInterruptedException)
    {
      Thread.currentThread().interrupt();
    }
    checkError();
    if (((partial) && (length != iobuffer.length)) || (length == 0)) {
      return;
    }
    throw new InterruptedIOException();
  }
  
  private void checkError()
    throws IOException
  {
    if (ioe != null)
    {
      IOException e = ioe;
      ioe = null;
      throw e;
    }
  }
  
  /* Error */
  private void runThread()
  {
    // Byte code:
    //   0: aload_0
    //   1: invokespecial 158	org/eclipse/mylyn/commons/core/io/TimeoutOutputStream:writeUntilDone	()V
    //   4: goto +252 -> 256
    //   7: astore_1
    //   8: aload_0
    //   9: dup
    //   10: astore_2
    //   11: monitorenter
    //   12: aload_0
    //   13: aload_1
    //   14: putfield 136	org/eclipse/mylyn/commons/core/io/TimeoutOutputStream:ioe	Ljava/io/IOException;
    //   17: aload_2
    //   18: monitorexit
    //   19: goto +6 -> 25
    //   22: aload_2
    //   23: monitorexit
    //   24: athrow
    //   25: aload_0
    //   26: invokespecial 157	org/eclipse/mylyn/commons/core/io/TimeoutOutputStream:waitUntilClosed	()V
    //   29: aload_0
    //   30: getfield 137	org/eclipse/mylyn/commons/core/io/TimeoutOutputStream:out	Ljava/io/OutputStream;
    //   33: invokevirtual 143	java/io/OutputStream:close	()V
    //   36: goto +79 -> 115
    //   39: astore 4
    //   41: aload_0
    //   42: dup
    //   43: astore 5
    //   45: monitorenter
    //   46: aload_0
    //   47: aload 4
    //   49: putfield 136	org/eclipse/mylyn/commons/core/io/TimeoutOutputStream:ioe	Ljava/io/IOException;
    //   52: aload 5
    //   54: monitorexit
    //   55: goto +7 -> 62
    //   58: aload 5
    //   60: monitorexit
    //   61: athrow
    //   62: aload_0
    //   63: dup
    //   64: astore 7
    //   66: monitorenter
    //   67: aload_0
    //   68: aconst_null
    //   69: putfield 138	org/eclipse/mylyn/commons/core/io/TimeoutOutputStream:thread	Ljava/lang/Thread;
    //   72: aload_0
    //   73: invokevirtual 146	java/lang/Object:notify	()V
    //   76: aload 7
    //   78: monitorexit
    //   79: goto +291 -> 370
    //   82: aload 7
    //   84: monitorexit
    //   85: athrow
    //   86: astore 6
    //   88: aload_0
    //   89: dup
    //   90: astore 7
    //   92: monitorenter
    //   93: aload_0
    //   94: aconst_null
    //   95: putfield 138	org/eclipse/mylyn/commons/core/io/TimeoutOutputStream:thread	Ljava/lang/Thread;
    //   98: aload_0
    //   99: invokevirtual 146	java/lang/Object:notify	()V
    //   102: aload 7
    //   104: monitorexit
    //   105: goto +7 -> 112
    //   108: aload 7
    //   110: monitorexit
    //   111: athrow
    //   112: aload 6
    //   114: athrow
    //   115: aload_0
    //   116: dup
    //   117: astore 7
    //   119: monitorenter
    //   120: aload_0
    //   121: aconst_null
    //   122: putfield 138	org/eclipse/mylyn/commons/core/io/TimeoutOutputStream:thread	Ljava/lang/Thread;
    //   125: aload_0
    //   126: invokevirtual 146	java/lang/Object:notify	()V
    //   129: aload 7
    //   131: monitorexit
    //   132: goto +238 -> 370
    //   135: aload 7
    //   137: monitorexit
    //   138: athrow
    //   139: astore_3
    //   140: aload_0
    //   141: invokespecial 157	org/eclipse/mylyn/commons/core/io/TimeoutOutputStream:waitUntilClosed	()V
    //   144: aload_0
    //   145: getfield 137	org/eclipse/mylyn/commons/core/io/TimeoutOutputStream:out	Ljava/io/OutputStream;
    //   148: invokevirtual 143	java/io/OutputStream:close	()V
    //   151: goto +79 -> 230
    //   154: astore 4
    //   156: aload_0
    //   157: dup
    //   158: astore 5
    //   160: monitorenter
    //   161: aload_0
    //   162: aload 4
    //   164: putfield 136	org/eclipse/mylyn/commons/core/io/TimeoutOutputStream:ioe	Ljava/io/IOException;
    //   167: aload 5
    //   169: monitorexit
    //   170: goto +7 -> 177
    //   173: aload 5
    //   175: monitorexit
    //   176: athrow
    //   177: aload_0
    //   178: dup
    //   179: astore 7
    //   181: monitorenter
    //   182: aload_0
    //   183: aconst_null
    //   184: putfield 138	org/eclipse/mylyn/commons/core/io/TimeoutOutputStream:thread	Ljava/lang/Thread;
    //   187: aload_0
    //   188: invokevirtual 146	java/lang/Object:notify	()V
    //   191: aload 7
    //   193: monitorexit
    //   194: goto +60 -> 254
    //   197: aload 7
    //   199: monitorexit
    //   200: athrow
    //   201: astore 6
    //   203: aload_0
    //   204: dup
    //   205: astore 7
    //   207: monitorenter
    //   208: aload_0
    //   209: aconst_null
    //   210: putfield 138	org/eclipse/mylyn/commons/core/io/TimeoutOutputStream:thread	Ljava/lang/Thread;
    //   213: aload_0
    //   214: invokevirtual 146	java/lang/Object:notify	()V
    //   217: aload 7
    //   219: monitorexit
    //   220: goto +7 -> 227
    //   223: aload 7
    //   225: monitorexit
    //   226: athrow
    //   227: aload 6
    //   229: athrow
    //   230: aload_0
    //   231: dup
    //   232: astore 7
    //   234: monitorenter
    //   235: aload_0
    //   236: aconst_null
    //   237: putfield 138	org/eclipse/mylyn/commons/core/io/TimeoutOutputStream:thread	Ljava/lang/Thread;
    //   240: aload_0
    //   241: invokevirtual 146	java/lang/Object:notify	()V
    //   244: aload 7
    //   246: monitorexit
    //   247: goto +7 -> 254
    //   250: aload 7
    //   252: monitorexit
    //   253: athrow
    //   254: aload_3
    //   255: athrow
    //   256: aload_0
    //   257: invokespecial 157	org/eclipse/mylyn/commons/core/io/TimeoutOutputStream:waitUntilClosed	()V
    //   260: aload_0
    //   261: getfield 137	org/eclipse/mylyn/commons/core/io/TimeoutOutputStream:out	Ljava/io/OutputStream;
    //   264: invokevirtual 143	java/io/OutputStream:close	()V
    //   267: goto +79 -> 346
    //   270: astore 4
    //   272: aload_0
    //   273: dup
    //   274: astore 5
    //   276: monitorenter
    //   277: aload_0
    //   278: aload 4
    //   280: putfield 136	org/eclipse/mylyn/commons/core/io/TimeoutOutputStream:ioe	Ljava/io/IOException;
    //   283: aload 5
    //   285: monitorexit
    //   286: goto +7 -> 293
    //   289: aload 5
    //   291: monitorexit
    //   292: athrow
    //   293: aload_0
    //   294: dup
    //   295: astore 7
    //   297: monitorenter
    //   298: aload_0
    //   299: aconst_null
    //   300: putfield 138	org/eclipse/mylyn/commons/core/io/TimeoutOutputStream:thread	Ljava/lang/Thread;
    //   303: aload_0
    //   304: invokevirtual 146	java/lang/Object:notify	()V
    //   307: aload 7
    //   309: monitorexit
    //   310: goto +60 -> 370
    //   313: aload 7
    //   315: monitorexit
    //   316: athrow
    //   317: astore 6
    //   319: aload_0
    //   320: dup
    //   321: astore 7
    //   323: monitorenter
    //   324: aload_0
    //   325: aconst_null
    //   326: putfield 138	org/eclipse/mylyn/commons/core/io/TimeoutOutputStream:thread	Ljava/lang/Thread;
    //   329: aload_0
    //   330: invokevirtual 146	java/lang/Object:notify	()V
    //   333: aload 7
    //   335: monitorexit
    //   336: goto +7 -> 343
    //   339: aload 7
    //   341: monitorexit
    //   342: athrow
    //   343: aload 6
    //   345: athrow
    //   346: aload_0
    //   347: dup
    //   348: astore 7
    //   350: monitorenter
    //   351: aload_0
    //   352: aconst_null
    //   353: putfield 138	org/eclipse/mylyn/commons/core/io/TimeoutOutputStream:thread	Ljava/lang/Thread;
    //   356: aload_0
    //   357: invokevirtual 146	java/lang/Object:notify	()V
    //   360: aload 7
    //   362: monitorexit
    //   363: goto +7 -> 370
    //   366: aload 7
    //   368: monitorexit
    //   369: athrow
    //   370: return
    // Line number table:
    //   Java source line #229	-> byte code offset #0
    //   Java source line #230	-> byte code offset #7
    //   Java source line #231	-> byte code offset #8
    //   Java source line #232	-> byte code offset #12
    //   Java source line #231	-> byte code offset #17
    //   Java source line #235	-> byte code offset #25
    //   Java source line #237	-> byte code offset #29
    //   Java source line #238	-> byte code offset #39
    //   Java source line #239	-> byte code offset #41
    //   Java source line #240	-> byte code offset #46
    //   Java source line #239	-> byte code offset #52
    //   Java source line #243	-> byte code offset #62
    //   Java source line #244	-> byte code offset #67
    //   Java source line #245	-> byte code offset #72
    //   Java source line #243	-> byte code offset #76
    //   Java source line #242	-> byte code offset #86
    //   Java source line #243	-> byte code offset #88
    //   Java source line #244	-> byte code offset #93
    //   Java source line #245	-> byte code offset #98
    //   Java source line #243	-> byte code offset #102
    //   Java source line #247	-> byte code offset #112
    //   Java source line #243	-> byte code offset #115
    //   Java source line #244	-> byte code offset #120
    //   Java source line #245	-> byte code offset #125
    //   Java source line #243	-> byte code offset #129
    //   Java source line #234	-> byte code offset #139
    //   Java source line #235	-> byte code offset #140
    //   Java source line #237	-> byte code offset #144
    //   Java source line #238	-> byte code offset #154
    //   Java source line #239	-> byte code offset #156
    //   Java source line #240	-> byte code offset #161
    //   Java source line #239	-> byte code offset #167
    //   Java source line #243	-> byte code offset #177
    //   Java source line #244	-> byte code offset #182
    //   Java source line #245	-> byte code offset #187
    //   Java source line #243	-> byte code offset #191
    //   Java source line #242	-> byte code offset #201
    //   Java source line #243	-> byte code offset #203
    //   Java source line #244	-> byte code offset #208
    //   Java source line #245	-> byte code offset #213
    //   Java source line #243	-> byte code offset #217
    //   Java source line #247	-> byte code offset #227
    //   Java source line #243	-> byte code offset #230
    //   Java source line #244	-> byte code offset #235
    //   Java source line #245	-> byte code offset #240
    //   Java source line #243	-> byte code offset #244
    //   Java source line #248	-> byte code offset #254
    //   Java source line #235	-> byte code offset #256
    //   Java source line #237	-> byte code offset #260
    //   Java source line #238	-> byte code offset #270
    //   Java source line #239	-> byte code offset #272
    //   Java source line #240	-> byte code offset #277
    //   Java source line #239	-> byte code offset #283
    //   Java source line #243	-> byte code offset #293
    //   Java source line #244	-> byte code offset #298
    //   Java source line #245	-> byte code offset #303
    //   Java source line #243	-> byte code offset #307
    //   Java source line #242	-> byte code offset #317
    //   Java source line #243	-> byte code offset #319
    //   Java source line #244	-> byte code offset #324
    //   Java source line #245	-> byte code offset #329
    //   Java source line #243	-> byte code offset #333
    //   Java source line #247	-> byte code offset #343
    //   Java source line #243	-> byte code offset #346
    //   Java source line #244	-> byte code offset #351
    //   Java source line #245	-> byte code offset #356
    //   Java source line #243	-> byte code offset #360
    //   Java source line #249	-> byte code offset #370
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	371	0	this	TimeoutOutputStream
    //   7	7	1	e	IOException
    //   10	13	2	Ljava/lang/Object;	Object
    //   139	116	3	localObject1	Object
    //   39	9	4	e	IOException
    //   154	9	4	e	IOException
    //   270	9	4	e	IOException
    //   43	16	5	Ljava/lang/Object;	Object
    //   158	16	5	Ljava/lang/Object;	Object
    //   274	16	5	Ljava/lang/Object;	Object
    //   86	27	6	localObject2	Object
    //   201	27	6	localObject3	Object
    //   317	27	6	localObject4	Object
    //   64	19	7	Ljava/lang/Object;	Object
    //   90	19	7	Ljava/lang/Object;	Object
    //   117	19	7	Ljava/lang/Object;	Object
    //   179	19	7	Ljava/lang/Object;	Object
    //   205	19	7	Ljava/lang/Object;	Object
    //   232	19	7	Ljava/lang/Object;	Object
    //   295	19	7	Ljava/lang/Object;	Object
    //   321	19	7	Ljava/lang/Object;	Object
    //   348	19	7	Ljava/lang/Object;	Object
    // Exception table:
    //   from	to	target	type
    //   0	4	7	java/io/IOException
    //   12	19	22	finally
    //   22	24	22	finally
    //   29	36	39	java/io/IOException
    //   46	55	58	finally
    //   58	61	58	finally
    //   67	79	82	finally
    //   82	85	82	finally
    //   29	62	86	finally
    //   93	105	108	finally
    //   108	111	108	finally
    //   120	132	135	finally
    //   135	138	135	finally
    //   0	25	139	finally
    //   144	151	154	java/io/IOException
    //   161	170	173	finally
    //   173	176	173	finally
    //   182	194	197	finally
    //   197	200	197	finally
    //   144	177	201	finally
    //   208	220	223	finally
    //   223	226	223	finally
    //   235	247	250	finally
    //   250	253	250	finally
    //   260	267	270	java/io/IOException
    //   277	286	289	finally
    //   289	292	289	finally
    //   298	310	313	finally
    //   313	316	313	finally
    //   260	293	317	finally
    //   324	336	339	finally
    //   339	342	339	finally
    //   351	363	366	finally
    //   366	369	366	finally
  }
  
  private synchronized void waitUntilClosed()
  {
    waitingForClose = true;
    notify();
    while (!closeRequested) {
      try
      {
        wait();
      }
      catch (InterruptedException localInterruptedException)
      {
        closeRequested = true;
      }
    }
  }
  
  private void writeUntilDone()
    throws IOException
  {
    int bytesUntilFlush = -1;
    for (;;)
    {
      synchronized (this)
      {
        if ((closeRequested) && (length == 0)) {
          return;
        }
        if ((length == 0) && (!flushRequested))
        {
          try
          {
            wait();
          }
          catch (InterruptedException localInterruptedException)
          {
            closeRequested = true;
          }
          continue;
        }
        int off = head;
        int len = iobuffer.length - head;
        if (len > length) {
          len = length;
        }
        if ((flushRequested) && (bytesUntilFlush < 0))
        {
          flushRequested = false;
          bytesUntilFlush = length;
        }
      }
      int len;
      int off;
      if (len != 0) {
        try
        {
          out.write(iobuffer, off, len);
        }
        catch (InterruptedIOException e)
        {
          len = bytesTransferred;
        }
      }
      if (bytesUntilFlush >= 0)
      {
        bytesUntilFlush -= len;
        if (bytesUntilFlush <= 0)
        {
          try
          {
            out.flush();
          }
          catch (InterruptedIOException localInterruptedIOException1) {}
          bytesUntilFlush = -1;
        }
      }
      if (len == 0) {
        continue;
      }
      synchronized (this)
      {
        head = ((head + len) % iobuffer.length);
        length -= len;
        notify();
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.commons.core.io.TimeoutOutputStream
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.commons.core.io;

class TimeoutInputStream$1
  implements Runnable
{
  TimeoutInputStream$1(TimeoutInputStream paramTimeoutInputStream) {}
  
  public void run()
  {
    TimeoutInputStream.access$0(this$0);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.commons.core.io.TimeoutInputStream.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.commons.core.io;

import java.io.FilterInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InterruptedIOException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;

public class PollingInputStream
  extends FilterInputStream
{
  private static final boolean DEBUG = false;
  private final int numAttempts;
  private final IProgressMonitor monitor;
  private boolean cancellable;
  
  public PollingInputStream(InputStream in, int numAttempts, IProgressMonitor monitor)
  {
    super(in);
    this.numAttempts = numAttempts;
    this.monitor = monitor;
    cancellable = true;
  }
  
  /* Error */
  public void close()
    throws InterruptedIOException
  {
    // Byte code:
    //   0: iconst_0
    //   1: istore_1
    //   2: aload_0
    //   3: invokevirtual 112	org/eclipse/mylyn/commons/core/io/PollingInputStream:readPendingInput	()V
    //   6: goto +168 -> 174
    //   9: astore_2
    //   10: new 57	org/eclipse/core/runtime/Status
    //   13: dup
    //   14: iconst_4
    //   15: ldc 1
    //   17: aload_2
    //   18: invokevirtual 102	java/io/IOException:getMessage	()Ljava/lang/String;
    //   21: aload_2
    //   22: invokespecial 110	org/eclipse/core/runtime/Status:<init>	(ILjava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V
    //   25: invokestatic 111	org/eclipse/mylyn/commons/core/StatusHandler:log	(Lorg/eclipse/core/runtime/IStatus;)V
    //   28: iconst_0
    //   29: istore 4
    //   31: goto +62 -> 93
    //   34: aload_0
    //   35: getfield 99	org/eclipse/mylyn/commons/core/io/PollingInputStream:in	Ljava/io/InputStream;
    //   38: ifnull +10 -> 48
    //   41: aload_0
    //   42: getfield 99	org/eclipse/mylyn/commons/core/io/PollingInputStream:in	Ljava/io/InputStream;
    //   45: invokevirtual 105	java/io/InputStream:close	()V
    //   48: iconst_1
    //   49
1 2 3 4 5 6

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd