org.eclipse.team.core_3.6.0.I20110525-0800

  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 197	org/eclipse/team/internal/core/streams/TimeoutInputStream:readUntilDone	()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 173	org/eclipse/team/internal/core/streams/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 200	org/eclipse/team/internal/core/streams/TimeoutInputStream:waitUntilClosed	()V
    //   29: aload_0
    //   30: getfield 174	org/eclipse/team/internal/core/streams/TimeoutInputStream:in	Ljava/io/InputStream;
    //   33: invokevirtual 177	java/io/InputStream: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 173	org/eclipse/team/internal/core/streams/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: dup
    //   64: astore 7
    //   66: monitorenter
    //   67: aload_0
    //   68: aconst_null
    //   69: putfield 175	org/eclipse/team/internal/core/streams/TimeoutInputStream:thread	Ljava/lang/Thread;
    //   72: aload_0
    //   73: invokevirtual 182	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 175	org/eclipse/team/internal/core/streams/TimeoutInputStream:thread	Ljava/lang/Thread;
    //   98: aload_0
    //   99: invokevirtual 182	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 175	org/eclipse/team/internal/core/streams/TimeoutInputStream:thread	Ljava/lang/Thread;
    //   125: aload_0
    //   126: invokevirtual 182	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 200	org/eclipse/team/internal/core/streams/TimeoutInputStream:waitUntilClosed	()V
    //   144: aload_0
    //   145: getfield 174	org/eclipse/team/internal/core/streams/TimeoutInputStream:in	Ljava/io/InputStream;
    //   148: invokevirtual 177	java/io/InputStream: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 173	org/eclipse/team/internal/core/streams/TimeoutInputStream: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 175	org/eclipse/team/internal/core/streams/TimeoutInputStream:thread	Ljava/lang/Thread;
    //   187: aload_0
    //   188: invokevirtual 182	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 175	org/eclipse/team/internal/core/streams/TimeoutInputStream:thread	Ljava/lang/Thread;
    //   213: aload_0
    //   214: invokevirtual 182	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 175	org/eclipse/team/internal/core/streams/TimeoutInputStream:thread	Ljava/lang/Thread;
    //   240: aload_0
    //   241: invokevirtual 182	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 200	org/eclipse/team/internal/core/streams/TimeoutInputStream:waitUntilClosed	()V
    //   260: aload_0
    //   261: getfield 174	org/eclipse/team/internal/core/streams/TimeoutInputStream:in	Ljava/io/InputStream;
    //   264: invokevirtual 177	java/io/InputStream: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 173	org/eclipse/team/internal/core/streams/TimeoutInputStream: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 175	org/eclipse/team/internal/core/streams/TimeoutInputStream:thread	Ljava/lang/Thread;
    //   303: aload_0
    //   304: invokevirtual 182	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 175	org/eclipse/team/internal/core/streams/TimeoutInputStream:thread	Ljava/lang/Thread;
    //   329: aload_0
    //   330: invokevirtual 182	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 175	org/eclipse/team/internal/core/streams/TimeoutInputStream:thread	Ljava/lang/Thread;
    //   356: aload_0
    //   357: invokevirtual 182	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 #218	-> byte code offset #0
    //   Java source line #219	-> byte code offset #7
    //   Java source line #220	-> byte code offset #8
    //   Java source line #222	-> byte code offset #25
    //   Java source line #224	-> byte code offset #29
    //   Java source line #225	-> byte code offset #39
    //   Java source line #226	-> byte code offset #41
    //   Java source line #228	-> byte code offset #62
    //   Java source line #229	-> byte code offset #67
    //   Java source line #230	-> byte code offset #72
    //   Java source line #228	-> byte code offset #76
    //   Java source line #227	-> byte code offset #86
    //   Java source line #228	-> byte code offset #88
    //   Java source line #229	-> byte code offset #93
    //   Java source line #230	-> byte code offset #98
    //   Java source line #228	-> byte code offset #102
    //   Java source line #232	-> byte code offset #112
    //   Java source line #228	-> byte code offset #115
    //   Java source line #229	-> byte code offset #120
    //   Java source line #230	-> byte code offset #125
    //   Java source line #228	-> byte code offset #129
    //   Java source line #221	-> byte code offset #139
    //   Java source line #222	-> byte code offset #140
    //   Java source line #224	-> byte code offset #144
    //   Java source line #225	-> byte code offset #154
    //   Java source line #226	-> byte code offset #156
    //   Java source line #228	-> byte code offset #177
    //   Java source line #229	-> byte code offset #182
    //   Java source line #230	-> byte code offset #187
    //   Java source line #228	-> byte code offset #191
    //   Java source line #227	-> byte code offset #201
    //   Java source line #228	-> byte code offset #203
    //   Java source line #229	-> byte code offset #208
    //   Java source line #230	-> byte code offset #213
    //   Java source line #228	-> byte code offset #217
    //   Java source line #232	-> byte code offset #227
    //   Java source line #228	-> byte code offset #230
    //   Java source line #229	-> byte code offset #235
    //   Java source line #230	-> byte code offset #240
    //   Java source line #228	-> byte code offset #244
    //   Java source line #233	-> byte code offset #254
    //   Java source line #222	-> byte code offset #256
    //   Java source line #224	-> byte code offset #260
    //   Java source line #225	-> byte code offset #270
    //   Java source line #226	-> byte code offset #272
    //   Java source line #228	-> byte code offset #293
    //   Java source line #229	-> byte code offset #298
    //   Java source line #230	-> byte code offset #303
    //   Java source line #228	-> byte code offset #307
    //   Java source line #227	-> byte code offset #317
    //   Java source line #228	-> byte code offset #319
    //   Java source line #229	-> byte code offset #324
    //   Java source line #230	-> byte code offset #329
    //   Java source line #228	-> byte code offset #333
    //   Java source line #232	-> byte code offset #343
    //   Java source line #228	-> byte code offset #346
    //   Java source line #229	-> byte code offset #351
    //   Java source line #230	-> byte code offset #356
    //   Java source line #228	-> byte code offset #360
    //   Java source line #234	-> byte code offset #370
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	371	0	this	TimeoutInputStream
    //   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 readUntilDone()
    throws IOException
  {
    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)
    {
      if (Policy.DEBUG_STREAMS) {
        System.out.println("InputStream growing to " + newSize + " bytes");
      }
      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.team.internal.core.streams.TimeoutInputStream
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.team.internal.core.streams;

class TimeoutOutputStream$1
  implements Runnable
{
  final TimeoutOutputStream this$0;
  
  TimeoutOutputStream$1(TimeoutOutputStream paramTimeoutOutputStream)
  {
    this$0 = paramTimeoutOutputStream;
  }
  
  public void run()
  {
    TimeoutOutputStream.access$0(this$0);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.core.streams.TimeoutOutputStream.1
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.team.internal.core.streams;

import java.io.BufferedOutputStream;
import java.io.FilterOutputStream;
import java.io.IOException;
import java.io.InterruptedIOException;
import java.io.OutputStream;
import org.eclipse.team.internal.core.Messages;

public class TimeoutOutputStream
  extends FilterOutputStream
{
  private final long writeTimeout;
  private final long closeTimeout;
  private 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 159	org/eclipse/team/internal/core/streams/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 137	org/eclipse/team/internal/core/streams/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 158	org/eclipse/team/internal/core/streams/TimeoutOutputStream:waitUntilClosed	()V
    //   29: aload_0
    //   30: getfield 138	org/eclipse/team/internal/core/streams/TimeoutOutputStream:out	Ljava/io/OutputStream;
    //   33: invokevirtual 144	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 137	org/eclipse/team/internal/core/streams/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 139	org/eclipse/team/internal/core/streams/TimeoutOutputStream:thread	Ljava/lang/Thread;
    //   72: aload_0
    //   73: invokevirtual 147	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 139	org/eclipse/team/internal/core/streams/TimeoutOutputStream:thread	Ljava/lang/Thread;
    //   98: aload_0
    //   99: invokevirtual 147	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 139	org/eclipse/team/internal/core/streams/TimeoutOutputStream:thread	Ljava/lang/Thread;
    //   125: aload_0
    //   126: invokevirtual 147	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 158	org/eclipse/team/internal/core/streams/TimeoutOutputStream:waitUntilClosed	()V
    //   144: aload_0
    //   145: getfield 138	org/eclipse/team/internal/core/streams/TimeoutOutputStream:out	Ljava/io/OutputStream;
    //   148: invokevirtual 144	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 137	org/eclipse/team/internal/core/streams/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 139	org/eclipse/team/internal/core/streams/TimeoutOutputStream:thread	Ljava/lang/Thread;
    //   187: aload_0
    //   188: invokevirtual 147	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 139	org/eclipse/team/internal/core/streams/TimeoutOutputStream:thread	Ljava/lang/Thread;
    //   213: aload_0
    //   214: invokevirtual 147	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 139	org/eclipse/team/internal/core/streams/TimeoutOutputStream:thread	Ljava/lang/Thread;
    //   240: aload_0
    //   241: invokevirtual 147	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 158	org/eclipse/team/internal/core/streams/TimeoutOutputStream:waitUntilClosed	()V
    //   260: aload_0
    //   261: getfield 138	org/eclipse/team/internal/core/streams/TimeoutOutputStream:out	Ljava/io/OutputStream;
    //   264: invokevirtual 144	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 137	org/eclipse/team/internal/core/streams/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 139	org/eclipse/team/internal/core/streams/TimeoutOutputStream:thread	Ljava/lang/Thread;
    //   303: aload_0
    //   304: invokevirtual 147	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 139	org/eclipse/team/internal/core/streams/TimeoutOutputStream:thread	Ljava/lang/Thread;
    //   329: aload_0
    //   330: invokevirtual 147	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 139	org/eclipse/team/internal/core/streams/TimeoutOutputStream:thread	Ljava/lang/Thread;
    //   356: aload_0
    //   357: invokevirtual 147	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 #195	-> byte code offset #0
    //   Java source line #196	-> byte code offset #7
    //   Java source line #197	-> byte code offset #8
    //   Java source line #199	-> byte code offset #25
    //   Java source line #201	-> byte code offset #29
    //   Java source line #202	-> byte code offset #39
    //   Java source line #203	-> byte code offset #41
    //   Java source line #205	-> byte code offset #62
    //   Java source line #206	-> byte code offset #67
    //   Java source line #207	-> byte code offset #72
    //   Java source line #205	-> byte code offset #76
    //   Java source line #204	-> byte code offset #86
    //   Java source line #205	-> byte code offset #88
    //   Java source line #206	-> byte code offset #93
    //   Java source line #207	-> byte code offset #98
    //   Java source line #205	-> byte code offset #102
    //   Java source line #209	-> byte code offset #112
    //   Java source line #205	-> byte code offset #115
    //   Java source line #206	-> byte code offset #120
    //   Java source line #207	-> byte code offset #125
    //   Java source line #205	-> byte code offset #129
    //   Java source line #198	-> byte code offset #139
    //   Java source line #199	-> byte code offset #140
    //   Java source line #201	-> byte code offset #144
    //   Java source line #202	-> byte code offset #154
    //   Java source line #203	-> byte code offset #156
    //   Java source line #205	-> byte code offset #177
    //   Java source line #206	-> byte code offset #182
    //   Java source line #207	-> byte code offset #187
    //   Java source line #205	-> byte code offset #191
    //   Java source line #204	-> byte code offset #201
    //   Java source line #205	-> byte code offset #203
    //   Java source line #206	-> byte code offset #208
    //   Java source line #207	-> byte code offset #213
    //   Java source line #205	-> byte code offset #217
    //   Java source line #209	-> byte code offset #227
    //   Java source line #205	-> byte code offset #230
    //   Java source line #206	-> byte code offset #235
    //   Java source line #207	-> byte code offset #240
    //   Java source line #205	-> byte code offset #244
    //   Java source line #210	-> byte code offset #254
    //   Java source line #199	-> byte code offset #256
    //   Java source line #201	-> byte code offset #260
    //   Java source line #202	-> byte code offset #270
    //   Java source line #203	-> byte code offset #272
    //   Java source line #205	-> byte code offset #293
    //   Java source line #206	-> byte code offset #298
    //   Java source line #207	-> byte code offset #303
    //   Java source line #205	-> byte code offset #307
    //   Java source line #204	-> byte code offset #317
    //   Java source line #205	-> byte code offset #319
    //   Java source line #206	-> byte code offset #324
    //   Java source line #207	-> byte code offset #329
    //   Java source line #205	-> byte code offset #333
    //   Java source line #209	-> byte code offset #343
    //   Java source line #205	-> byte code offset #346
    //   Java source line #206	-> byte code offset #351
    //   Java source line #207	-> byte code offset #356
    //   Java source line #205	-> byte code offset #360
    //   Java source line #211	-> 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.team.internal.core.streams.TimeoutOutputStream
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.team.internal.core.subscribers;

import org.eclipse.core.resources.mapping.ResourceMapping;
import org.eclipse.core.resources.mapping.ResourceTraversal;
import org.eclipse.core.runtime.ISafeRunnable;
import org.eclipse.team.core.mapping.ISynchronizationScopeChangeListener;

class AbstractSynchronizationScope$1
  implements ISafeRunnable
{
  final AbstractSynchronizationScope this$0;
  private final Object val$listener;
  private final ResourceMapping[] val$newMappings;
  private final ResourceTraversal[] val$newTraversals;
  
  AbstractSynchronizationScope$1(AbstractSynchronizationScope paramAbstractSynchronizationScope, Object paramObject, ResourceMapping[] paramArrayOfResourceMapping, ResourceTraversal[] paramArrayOfResourceTraversal)
  {
    this$0 = paramAbstractSynchronizationScope;val$listener = paramObject;val$newMappings = paramArrayOfResourceMapping;val$newTraversals = paramArrayOfResourceTraversal;
  }
  
  public void run()
    throws Exception
  {
    ((ISynchronizationScopeChangeListener)val$listener).scopeChanged(this$0, val$newMappings, val$newTraversals);
  }
  
  public void handleException(Throwable exception) {}
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.core.subscribers.AbstractSynchronizationScope.1
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.team.internal.core.subscribers;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.mapping.ResourceMapping;
import org.eclipse.core.resources.mapping.ResourceTraversal;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.ISafeRunnable;
import org.eclipse.core.runtime.ListenerList;
import org.eclipse.core.runtime.SafeRunner;
import org.eclipse.team.core.mapping.ISynchronizationScope;
import org.eclipse.team.core.mapping.ISynchronizationScopeChangeListener;

public abstract class AbstractSynchronizationScope
  implements ISynchronizationScope
{
  private ListenerList listeners = new ListenerList(1);
  
  public IResource[] getRoots()
  {
    List result = new ArrayList();
    ResourceTraversal[] traversals = getTraversals();
    for (int i = 0; i < traversals.length; i++)
    {
      ResourceTraversal traversal = traversals[i];
      IResource[] resources = traversal.getResources();
      for (int j = 0; j < resources.length; j++)
      {
        IResource resource = resources[j];
        accumulateRoots(result, resource);
      }
    }
    return (IResource[])result.toArray(new IResource[result.size()]);
  }
  
  public boolean contains(IResource resource)
  {
    ResourceTraversal[] traversals = getTraversals();
    for (int i = 0; i < traversals.length; i++)
    {
      ResourceTraversal traversal = traversals[i];
      if (traversal.contains(resource)) {
        return true;
      }
    }
    return false;
  }
  
  private void accumulateRoots(List roots, IResource resource)
  {
    IPath resourcePath = resource.getFullPath();
    for (Iterator iter = roots.iterator(); iter.hasNext();)
    {
      IResource root = (IResource)iter.next();
      IPath rootPath = root.getFullPath();
      if (rootPath.isPrefixOf(resourcePath)) {
        return;
      }
      if (resourcePath.isPrefixOf(rootPath)) {
        iter.remove();
      }
    }
    roots.add(resource);
  }
  
  public void fireTraversalsChangedEvent(ResourceTraversal[] newTraversals, ResourceMapping[] newMappings)
  {
    Object[] allListeners = listeners.getListeners();
    for (int i = 0; i < allListeners.length; i++)
    {
      Object listener = allListeners[i];
      SafeRunner.run(new ISafeRunnable()
      {
        private final Object val$listener;
        private final ResourceMapping[] val$newMappings;
        private final ResourceTraversal[] val$newTraversals;
        
        public void run()
          throws Exception
        {
          ((ISynchronizationScopeChangeListener)val$listener).scopeChanged(AbstractSynchronizationScope.this, val$newMappings, val$newTraversals);
        }
        
        public void handleException(Throwable exception) {}
      });
    }
  }
  
  public void a
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26

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