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

    return null;
  }
  
  public static IFileRevision getRemote(IThreeWayDiff twd)
  {
    IResourceDiff rd = (IResourceDiff)twd.getRemoteChange();
    if (rd != null) {
      return rd.getAfterState();
    }
    rd = (IResourceDiff)twd.getLocalChange();
    if (rd != null) {
      return rd.getBeforeState();
    }
    return null;
  }
  
  public static SyncInfoToDiffConverter getDefault()
  {
    if (instance == null) {
      instance = new SyncInfoToDiffConverter();
    }
    return instance;
  }
}

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

import java.io.FilterInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InterruptedIOException;

public class CRLFtoLFInputStream
  extends FilterInputStream
{
  private boolean pendingByte = false;
  private int lastByte = -1;
  
  public CRLFtoLFInputStream(InputStream in)
  {
    super(in);
  }
  
  public int read()
    throws IOException
  {
    if (!pendingByte)
    {
      lastByte = in.read();
      pendingByte = true;
    }
    if (lastByte == 13)
    {
      lastByte = in.read();
      if (lastByte != 10)
      {
        if (lastByte == -1) {
          pendingByte = false;
        }
        return 13;
      }
    }
    pendingByte = false;
    return lastByte;
  }
  
  public int read(byte[] buffer, int off, int len)
    throws IOException
  {
    if (len == 0) {
      return 0;
    }
    if (len == 1)
    {
      int b = read();
      if (b == -1) {
        return -1;
      }
      buffer[off] = ((byte)b);
      return 1;
    }
    int count = 0;
    if (pendingByte)
    {
      buffer[off] = ((byte)lastByte);
      pendingByte = false;
      count = 1;
    }
    InterruptedIOException iioe = null;
    try
    {
      len = in.read(buffer, off + count, len - count);
      if (len == -1) {
        return count == 0 ? -1 : count;
      }
    }
    catch (InterruptedIOException e)
    {
      len = bytesTransferred;
      iioe = e;
      
      count += len;
      
      int j = off;
      for (int i = off; i < off + count; i++)
      {
        lastByte = buffer[i];
        if (lastByte == 13)
        {
          if (pendingByte) {
            buffer[(j++)] = 13;
          } else {
            pendingByte = true;
          }
        }
        else
        {
          if (pendingByte)
          {
            if (lastByte != 10) {
              buffer[(j++)] = 13;
            }
            pendingByte = false;
          }
          buffer[(j++)] = ((byte)lastByte);
        }
      }
      if (iioe != null)
      {
        bytesTransferred = (j - off);
        throw iioe;
      }
      return j - off;
    }
  }
  
  public long skip(long count)
    throws IOException
  {
    int actualCount = 0;
    try
    {
      while ((count-- > 0L) && (read() != -1)) {
        actualCount++;
      }
      return actualCount;
    }
    catch (InterruptedIOException e)
    {
      bytesTransferred = actualCount;
      throw e;
    }
  }
  
  public int available()
    throws IOException
  {
    return in.available() / 2;
  }
  
  public boolean markSupported()
  {
    return false;
  }
}

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

import java.io.FilterInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InterruptedIOException;

public class LFtoCRLFInputStream
  extends FilterInputStream
{
  private boolean mustReturnLF = false;
  
  public LFtoCRLFInputStream(InputStream in)
  {
    super(in);
  }
  
  public int read()
    throws IOException
  {
    if (mustReturnLF)
    {
      mustReturnLF = false;
      return 10;
    }
    int b = in.read();
    if (b == 10)
    {
      mustReturnLF = true;
      b = 13;
    }
    return b;
  }
  
  public int read(byte[] buffer, int off, int len)
    throws IOException
  {
    if (len == 0) {
      return 0;
    }
    if (len == 1)
    {
      int b = read();
      if (b == -1) {
        return -1;
      }
      buffer[off] = ((byte)b);
      return 1;
    }
    int count = 0;
    if (mustReturnLF)
    {
      mustReturnLF = false;
      buffer[(off++)] = 10;
      len--;
      count = 1;
      if (len < 2) {
        return count;
      }
    }
    len /= 2;
    int j = off + len;
    InterruptedIOException iioe = null;
    try
    {
      len = in.read(buffer, j, len);
      if (len == -1) {
        return count == 0 ? -1 : count;
      }
    }
    catch (InterruptedIOException e)
    {
      len = bytesTransferred;
      iioe = e;
      
      count += len;
      while (len-- > 0)
      {
        byte b = buffer[(j++)];
        if (b == 10)
        {
          buffer[(off++)] = 13;
          count++;
        }
        buffer[(off++)] = b;
      }
      if (iioe != null)
      {
        bytesTransferred = count;
        throw iioe;
      }
    }
    return count;
  }
  
  public long skip(long count)
    throws IOException
  {
    int actualCount = 0;
    try
    {
      while ((count-- > 0L) && (read() != -1)) {
        actualCount++;
      }
      return actualCount;
    }
    catch (InterruptedIOException e)
    {
      bytesTransferred = actualCount;
      throw e;
    }
  }
  
  public int available()
    throws IOException
  {
    return in.available();
  }
  
  public boolean markSupported()
  {
    return false;
  }
}

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

import java.io.FilterInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InterruptedIOException;
import java.io.PrintStream;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.team.internal.core.Messages;
import org.eclipse.team.internal.core.Policy;

public class PollingInputStream
  extends FilterInputStream
{
  private static final boolean DEBUG = Policy.DEBUG_STREAMS;
  private int numAttempts;
  private 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 137	org/eclipse/team/internal/core/streams/PollingInputStream:readPendingInput	()V
    //   6: goto +221 -> 227
    //   9: astore_2
    //   10: iconst_4
    //   11: aload_2
    //   12: invokevirtual 124	java/io/IOException:getMessage	()Ljava/lang/String;
    //   15: aload_2
    //   16: invokestatic 136	org/eclipse/team/internal/core/TeamPlugin:log	(ILjava/lang/String;Ljava/lang/Throwable;)V
    //   19: iconst_0
    //   20: istore 4
    //   22: goto +93 -> 115
    //   25: aload_0
    //   26: getfield 121	org/eclipse/team/internal/core/streams/PollingInputStream:in	Ljava/io/InputStream;
    //   29: ifnull +10 -> 39
    //   32: aload_0
    //   33: getfield 121	org/eclipse/team/internal/core/streams/PollingInputStream:in	Ljava/io/InputStream;
    //   36: invokevirtual 127	java/io/InputStream:close	()V
    //   39: iconst_1
    //   40: istore 4
    //   42: goto +73 -> 115
    //   45: pop
    //   46: aload_0
    //   47: invokespecial 138	org/eclipse/team/internal/core/streams/PollingInputStream:checkCancellation	()Z
    //   50: ifeq +11 -> 61
    //   53: new 69	org/eclipse/core/runtime/OperationCanceledException
    //   56: dup
    //   57: invokespecial 135	org/eclipse/core/runtime/OperationCanceledException:<init>	()V
    //   60: athrow
    //   61: iinc 1 1
    //   64: iload_1
    //   65: aload_0
    //   66: getfield 118	org/eclipse/team/internal/core/streams/PollingInputStream:numAttempts	I
    //   69: if_icmpne +14 -> 83
    //   72: new 64	java/io/InterruptedIOException
    //   75: dup
    //   76: getstatic 115	org/eclipse/team/internal/core/Messages:PollingInputStream_closeTimeout	Ljava/lang/String;
    //   79: invokespecial 130	java/io/InterruptedIOException:<init>	(Ljava/lang/String;)V
    //   82: athrow
    //   83: getstatic 119	org/eclipse/team/internal/core/streams/PollingInputStream:DEBUG	Z
    //   86: ifeq +29 -> 115
    //   89: getstatic 114	java/lang/System:out	Ljava/io/PrintStream;
    //   92: new 66	java/lang/StringBuffer
    //   95: dup
    //   96: ldc 1
    //   98: invokespecial 133	java/lang/StringBuffer:<init>	(Ljava/lang/String;)V
    //   101: iload_1
    //   102: invokevirtual 134	java/lang/StringBuffer:append	(I)Ljava/lang/StringBuffer;
    //   105: invokevirtual 132	java/lang/StringBuffer:toString	()Ljava/lang/String;
    //   108: invokevirtual 131	java/io/PrintStream:println	(Ljava/lang/String;)V
    //   111: goto +4 -> 115
    //   114: pop
    //   115: iload 4
    //   117: ifeq -92 -> 25
    //   120: goto +208 -> 328
    //   123: astore_3
    //   124: iconst_0
    //   125: istore 4
    //   127: goto +93 -> 220
    //   130: aload_0
    //   131: getfield 121	org/eclipse/team/internal/core/streams/PollingInputStream:in	Ljava/io/InputStream;
    //   134: ifnull +10 -> 144
    //   137: aload_0
    //   138: getfield 121	org/eclipse/team/internal/core/streams/PollingInputStream:in	Ljava/io/InputStream;
    //   141: invokevirtual 127	java/io/InputStream:close	()V
    //   144: iconst_1
    //   145: istore 4
    //   147: goto +73 -> 220
    //   150: pop
    //   151: aload_0
    //   152: invokespecial 138	org/eclipse/team/internal/core/streams/PollingInputStream:checkCancellation	()Z
    //   155: ifeq +11 -> 166
    //   158: new 69	org/eclipse/core/runtime/OperationCanceledException
    //   161: dup
    //   162: invokespecial 135	org/eclipse/core/runtime/OperationCanceledException:<init>	()V
    //   165: athrow
    //   166: iinc 1 1
    //   169: iload_1
    //   170: aload_0
    //   171: getfield 118	org/eclipse/team/internal/core/streams/PollingInputStream:numAttempts	I
    //   174: if_icmpne +14 -> 188
    //   177: new 64	java/io/InterruptedIOException
    //   180: dup
    //   181: getstatic 115	org/eclipse/team/internal/core/Messages:PollingInputStream_closeTimeout	Ljava/lang/String;
    //   184: invokespecial 130	java/io/InterruptedIOException:<init>	(Ljava/lang/String;)V
    //   187: athrow
    //   188: getstatic 119	org/eclipse/team/internal/core/streams/PollingInputStream:DEBUG	Z
    //   191: ifeq +29 -> 220
    //   194: getstatic 114	java/lang/System:out	Ljava/io/PrintStream;
    //   197: new 66	java/lang/StringBuffer
    //   200: dup
    //   201: ldc 1
    //   203: invokespecial 133	java/lang/StringBuffer:<init>	(Ljava/lang/String;)V
    //   206: iload_1
    //   207: invokevirtual 134	java/lang/StringBuffer:append	(I)Ljava/lang/StringBuffer;
    //   210: invokevirtual 132	java/lang/StringBuffer:toString	()Ljava/lang/String;
    //   213: invokevirtual 131	java/io/PrintStream:println	(Ljava/lang/String;)V
    //   216: goto +4 -> 220
    //   219: pop
    //   220: iload 4
    //   222: ifeq -92 -> 130
    //   225: aload_3
    //   226: athrow
    //   227: iconst_0
    //   228: istore 4
    //   230: goto +93 -> 323
    //   233: aload_0
    //   234: getfield 121	org/eclipse/team/internal/core/streams/PollingInputStream:in	Ljava/io/InputStream;
    //   237: ifnull +10 -> 247
    //   240: aload_0
    //   241: getfield 121	org/eclipse/team/internal/core/streams/PollingInputStream:in	Ljava/io/InputStream;
    //   244: invokevirtual 127	java/io/InputStream:close	()V
    //   247: iconst_1
    //   248: istore 4
    //   250: goto +73 -> 323
    //   253: pop
    //   254: aload_0
    //   255: invokespecial 138	org/eclipse/team/internal/core/streams/PollingInputStream:checkCancellation	()Z
    //   258: ifeq +11 -> 269
    //   261: new 69	org/eclipse/core/runtime/OperationCanceledException
    //   264: dup
    //   265: invokespecial 135	org/eclipse/core/runtime/OperationCanceledException:<init>	()V
    //   268: athrow
    //   269: iinc 1 1
    //   272: iload_1
    //   273: aload_0
    //   274: getfield 118	org/eclipse/team/internal/core/streams/PollingInputStream:numAttempts	I
    //   277: if_icmpne +14 -> 291
    //   280: new 64	java/io/InterruptedIOException
    //   283: dup
    //   284: getstatic 115	org/eclipse/team/internal/core/Messages:PollingInputStream_closeTimeout	Ljava/lang/String;
    //   287: invokespecial 130	java/io/InterruptedIOException:<init>	(Ljava/lang/String;)V
    //   290: athrow
    //   291: getstatic 119	org/eclipse/team/internal/core/streams/PollingInputStream:DEBUG	Z
    //   294: ifeq +29 -> 323
    //   297: getstatic 114	java/lang/System:out	Ljava/io/PrintStream;
    //   300: new 66	java/lang/StringBuffer
    //   303: dup
    //   304: ldc 1
    //   306: invokespecial 133	java/lang/StringBuffer:<init>	(Ljava/lang/String;)V
    //   309: iload_1
    //   310: invokevirtual 134	java/lang/StringBuffer:append	(I)Ljava/lang/StringBuffer;
    //   313: invokevirtual 132	java/lang/StringBuffer:toString	()Ljava/lang/String;
    //   316: invokevirtual 131	java/io/PrintStream:println	(Ljava/lang/String;)V
    //   319: goto +4 -> 323
    //   322: pop
    //   323: iload 4
    //   325: ifeq -92 -> 233
    //   328: return
    // Line number table:
    //   Java source line #64	-> byte code offset #0
    //   Java source line #66	-> byte code offset #2
    //   Java source line #67	-> byte code offset #9
    //   Java source line #70	-> byte code offset #10
    //   Java source line #72	-> byte code offset #19
    //   Java source line #73	-> byte code offset #22
    //   Java source line #75	-> byte code offset #25
    //   Java source line #76	-> byte code offset #32
    //   Java source line #77	-> byte code offset #39
    //   Java source line #78	-> byte code offset #45
    //   Java source line #79	-> byte code offset #46
    //   Java source line #80	-> byte code offset #61
    //   Java source line #81	-> byte code offset #72
    //   Java source line #82	-> byte code offset #83
    //   Java source line #83	-> byte code offset #114
    //   Java source line #73	-> byte code offset #115
    //   Java source line #71	-> byte code offset #123
    //   Java source line #72	-> byte code offset #124
    //   Java source line #73	-> byte code offset #127
    //   Java source line #75	-> byte code offset #130
    //   Java source line #76	-> byte code offset #137
    //   Java source line #77	-> byte code offset #144
    //   Java source line #78	-> byte code offset #150
    //   Java source line #79	-> byte code offset #151
    //   Java source line #80	-> byte code offset #166
    //   Java source line #81	-> byte code offset #177
    //   Java source line #82	-> byte code offset #188
    //   Java source line #83	-> byte code offset #219
    //   Java source line #73	-> byte code offset #220
    //   Java source line #87	-> byte code offset #225
    //   Java source line #72	-> byte code offset #227
    //   Java source line #73	-> byte code offset #230
    //   Java source line #75	-> byte code offset #233
    //   Java source line #76	-> byte code offset #240
    //   Java source line #77	-> byte code offset #247
    //   Java source line #78	-> byte code offset #253
    //   Java source line #79	-> byte code offset #254
    //   Java source line #80	-> byte code offset #269
    //   Java source line #81	-> byte code offset #280
    //   Java source line #82	-> byte code offset #291
    //   Java source line #83	-> byte code offset #322
    //   Java source line #73	-> byte code offset #323
    //   Java source line #88	-> byte code offset #328
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	329	0	this	PollingInputStream
    //   1	309	1	attempts	int
    //   9	7	2	e	IOException
    //   123	103	3	localObject	Object
    //   20	96	4	stop	boolean
    //   125	96	4	stop	boolean
    //   228	96	4	stop	boolean
    //   45	1	7	localInterruptedIOException1	InterruptedIOException
    //   114	1	8	localIOException1	IOException
    //   150	1	9	localInterruptedIOException2	InterruptedIOException
    //   219	1	10	localIOException2	IOException
    //   253	1	11	localInterruptedIOException3	InterruptedIOException
    //   322	1	12	localIOException3	IOException
    // Exception table:
    //   from	to	target	type
    //   2	6	9	java/io/IOException
    //   25	42	45	java/io/InterruptedIOException
    //   25	42	114	java/io/IOException
    //   2	19	123	finally
    //   130	147	150	java/io/InterruptedIOException
    //   130	147	219	java/io/IOException
    //   233	250	253	java/io/InterruptedIOException
    //   233	250	322	java/io/IOException
  }
  
  public int read()
    throws IOException
  {
    int attempts = 0;
    for (;;)
    {
      if (checkCancellation()) {
        throw new OperationCanceledException();
      }
      try
      {
        return in.read();
      }
      catch (InterruptedIOException localInterruptedIOException)
      {
        attempts++;
        if (attempts == numAttempts) {
          throw new InterruptedIOException(Messages.PollingInputStream_readTimeout);
        }
      }
      if (DEBUG) {
        System.out.println("read retry=" + attempts);
      }
    }
  }
  
  public int read(byte[] buffer, int off, int len)
    throws IOException
  {
    int attempts = 0;
    for (;;)
    {
      if (checkCancellation()) {
        throw new OperationCanceledException();
      }
      try
      {
        return in.read(buffer, off, len);
      }
      catch (InterruptedIOException e)
      {
        if (bytesTransferred != 0) {
          return bytesTransferred;
        }
        attempts++;
        if (attempts == numAttempts) {
          throw new InterruptedIOException(Messages.PollingInputStream_readTimeout);
        }
      }
      if (DEBUG) {
        System.out.println("read retry=" + attempts);
      }
    }
  }
  
  public long skip(long count)
    throws IOException
  {
    int attempts = 0;
    for (;;)
    {
      if (checkCancellation()) {
        throw new OperationCanceledException();
      }
      try
      {
        return in.skip(count);
      }
      catch (InterruptedIOException e)
      {
        if (bytesTransferred != 0) {
          return bytesTransferred;
        }
        attempts++;
        if (attempts == numAttempts) {
          throw new InterruptedIOException(Messages.PollingInputStream_readTimeout);
        }
      }
      if (DEBUG) {
        System.out.println("read retry=" + attempts);
      }
    }
  }
  
  protected void readPendingInput()
    throws IOException
  {
    byte[] buffer = new byte['?'];
    int available;
    do
    {
      available = in.available();
      if (available < 1) {
        break;
      }
      if (available > buffer.length) {
        available = buffer.length;
      }
    } while (in.read(buffer, 0, available) >= 1);
  }
  
  public void setIsCancellable(boolean cancellable)
  {
    this.cancellable = cancellable;
  }
  
  private boolean checkCancellation()
  {
    if (cancellable) {
      return monitor.isCanceled();
    }
    return false;
  }
}

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

import java.io.FilterOutputStream;
import java.io.IOException;
import java.io.InterruptedIOException;
import java.io.OutputStream;
import java.io.PrintStream;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.team.internal.core.Messages;
import org.eclipse.team.internal.core.Policy;

public class PollingOutputStream
  extends FilterOutputStream
{
  private static final boolean DEBUG = Policy.DEBUG_STREAMS;
  private int numAttempts;
  private IProgressMonitor monitor;
  private boolean cancellable;
  
  public PollingOutputStream(OutputStream out, int numAttempts, IProgressMonitor monitor)
  {
    super(out);
    this.numAttempts = numAttempts;
    this.monitor = monitor;
    cancellable = true;
  }
  
  public void write(int b)
    throws IOException
  {
    int attempts = 0;
    for (;;)
    {
      if (checkCancellation()) {
        throw new OperationCanceledException();
      }
      try
      {
        out.write(b);
        return;
      }
      catch (InterruptedIOException localInterruptedIOException)
      {
        attempts++;
        if (attempts == numAttempts) {
          throw new InterruptedIOException(Messages.PollingOutputStream_writeTimeout);
        }
      }
      if (DEBUG) {
        System.out.println("write retry=" + attempts);
      }
    }
  }
  
  public void write(byte[] buffer, int off, int len)
    throws IOException
  {
    int count = 0;
    int attempts = 0;
    for (;;)
    {
      if (checkCancellation()) {
        throw new OperationCanceledException();
      }
      try
      {
        out.write(buffer, off, len);
        return;
      }
      catch (InterruptedIOException e)
      {
        int amount = bytesTransferred;
        if (amount != 0)
        {
          len -= amount;
          if (len <= 0) {
            return;
          }
          off += amount;
          count += amount;
          attempts = 0;
        }
        attempts++;
        if (attempts == numAttempts)
        {
          e = new InterruptedIOException(Messages.PollingOutputStream_writeTimeout);
          bytesTransferred = count;
          throw e;
        }
      }
      if (DEBUG) {
        System.out.println("write retry=" + attempts);
      }
    }
  }
  
  public void flush()
    throws IOException
  {
    int count = 0;
    int attempts = 0;
    for (;;)
    {
      if (checkCancellation()) {
        throw new OperationCanceledException();
      }
      try
      {
        out.flush();
        return;
      }
      catch (InterruptedIOException e)
      {
        int amount = bytesTransferred;
        if (amount != 0)
        {
          count += amount;
          attempts = 0;
        }
        attempts++;
        if (attempts == numAttempts)
        {
          e = new InterruptedIOException(Messages.PollingOutputStream_writeTimeout);
          bytesTransferred = count;
          throw e;
        }
      }
      if (DEBUG) {
        System.out.println("write retry=" + attempts);
      }
    }
  }
  
  /* Error */
  public void close()
    throws IOException
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 105	org/eclipse/team/internal/core/streams/PollingOutputStream:numAttempts	I
    //   4: iconst_1
    //   5: isub
    //   6: istore_1
    //   7: aload_0
    //   8: getfield 108	org/eclipse/team/internal/core/streams/PollingOutputStream:out	Ljava/io/OutputStream;
    //   11: invokevirtual 113	java/io/OutputStream:flush	()V
    //   14: iconst_0
    //   15: istore_1
    //   16: goto +93 -> 109
    //   19: astore_2
    //   20: iconst_0
    //   21: istore_3
    //   22: goto +81 -> 103
    //   25: aload_0
    //   26: getfield 108	org/eclipse/team/internal/core/streams/PollingOutputStream:out	Ljava/io/OutputStream;
    //   29: invokevirtual 112	java/io/OutputStream:close	()V
    //   32: iconst_1
    //   33: istore_3
    //   34: goto +69 -> 103
    //   37: pop
    //   38: aload_0
    //   39: invokespecial 121	org/eclipse/team/internal/core/streams/PollingOutputStream:checkCancellation	()Z
    //   42: ifeq +11 -> 53
    //   45: new 63	org/eclipse/core/runtime/OperationCanceledException
    //   48: dup
    //   49: invokespecial 120	org/eclipse/core/runtime/OperationCanceledException:<init>	()V
    //   52: athrow
    //   53: iinc 1 1
    //   56: iload_1
    //   57: aload_0
    //   58: getfield 105	org/eclipse/team/internal/core/streams/PollingOutputStream:numAttempts	I
    //   61: if_icmpne +14 -> 75
    //   64: new 57	java/io/InterruptedIOException
    //   67: dup
    //   68: getstatic 102	org/eclipse/team/internal/core/Messages:PollingOutputStream_closeTimeout	Ljava/lang/String;
    //   71: invokespecial 111	java/io/InterruptedIOException:<init>	(Ljava/lang/String;)V
    //   74: athrow
    //   75: getstatic 106	org/eclipse/team/internal/core/streams/PollingOutputStream:DEBUG	Z
    //   78: ifeq +25 -> 103
    //   81: getstatic 101	java/lang/System:out	Ljava/io/PrintStream;
    //   84: new 60	java/lang/StringBuffer
    //   87: dup
    //   88: ldc 1
    //   90: invokespecial 118	java/lang/StringBuffer:<init>	(Ljava/lang/String;)V
    //   93: iload_1
    //   94: invokevirtual 119	java/lang/StringBuffer:append	(I)Ljava/lang/StringBuffer;
    //   97: invokevirtual 117	java/lang/StringBuffer:toString	()Ljava/lang/String;
    //   100: invokevirtual 116	java/io/PrintStream:println	(Ljava/lang/String;)V
    //   103: iload_3
    //   104: ifeq -79 -> 25
    //   107: aload_2
    //   108: athrow
    //   109: iconst_0
    //   110: istore_3
    //   111: goto +81 -> 192
    //   114: aload_0
    //   115: getfield 108	org/eclipse/team/internal/core/streams/PollingOutputStream:out	Ljava/io/OutputStream;
    //   118: invokevirtual 112	java/io/OutputStream:close	()V
    //   121: iconst_1
    //   122: istore_3
    //   123: goto +69 -> 192
    //   126: pop
    //   127: aload_0
    //   128: invokespecial 121	org/eclipse/team/internal/core/streams/PollingOutputStream:checkCancellation	()Z
    //   131: ifeq +11 -> 142
    //   134: new 63	org/eclipse/core/runtime/OperationCanceledException
    //   137: dup
    //   138: invokespecial 120	org/eclipse/core/runtime/OperationCanceledException:<init>	()V
    //   141: athrow
    //   142: iinc 1 1
    //   145: iload_1
    //   146: aload_0
    //   147: getfield 105	org/eclipse/team/internal/core/streams/PollingOutputStream:numAttempts	I
    //   150: if_icmpne +14 -> 164
    //   153: new 57	java/io/InterruptedIOException
    //   156: dup
    //   157: getstatic 102	org/eclipse/team/internal/core/Messages:PollingOutputStream_closeTimeout	Ljava/lang/String;
    //   160: invokespecial 111	java/io/InterruptedIOException:<init>	(Ljava/lang/String;)V
    //   163: athrow
    //   164: getstatic 106	org/eclipse/team/internal/core/streams/PollingOutputStream:DEBUG	Z
    //   167: ifeq +25 -> 192
    //   170: getstatic 101	java/lang/System:out	Ljava/io/PrintStream;
    //   173: new 60	java/lang/StringBuffer
    //   176: dup
    //   177: ldc 1
    //   179: invokespecial 118	java/lang/StringBuffer:<init>	(Ljava/lang/String;)V
    //   182: iload_1
    //   183: invokevirtual 119	java/lang/StringBuffer:append	(I)Ljava/lang/StringBuffer;
    //   186: invokevirtual 117	java/lang/StringBuffer:toString	()Ljava/lang/String;
    //   189: invokevirtual 116	java/io/PrintStream:println	(Ljava/lang/String;)V
    //   192: iload_3
    //   193: ifeq -79 -> 114
    //   196: return
    // Line number table:
    //   Java source line #147	-> byte code offset #0
    //   Java source line #149	-> byte code offset #7
    //   Java source line #150	-> byte code offset #14
    //   Java source line #151	-> byte code offset #19
    //   Java source line #152	-> byte code offset #20
    //   Java source line #153	-> byte code offset #22
    //   Java source line #155	-> byte code offset #25
    //   Java source line #156	-> byte code offset #32
    //   Java source line #157	-> byte code offset #37
    //   Java source line #158	-> byte code offset #38
    //   Java source line #159	-> byte code offset #53
    //   Java source line #160	-> byte code offset #64
    //   Java source line #161	-> byte code offset #75
    //   Java source line #153	-> byte code offset #103
    //   Java source line #164	-> byte code offset #107
    //   Java source line #152	-> byte code offset #109
    //   Java source line #153	-> byte code offset #111
    //   Java source line #155	-> byte code offset #114
    //   Java source line #156	-> byte code offset #121
    //   Java source line #157	-> byte code offset #126
    //   Java source line #158	-> byte code offset #127
    //   Java source line #159	-> byte code offset #142
    //   Java source line #160	-> byte code offset #153
    //   Java source line #161	-> byte code offset #164
    //   Java source line #153	-> byte code offset #192
    //   Java source line #165	-> byte code offset #196
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	197	0	this	PollingOutputStream
    //   6	177	1	attempts	int
    //   19	89	2	localObject	Object
    //   21	83	3	stop	boolean
    //   110	83	3	stop	boolean
    //   37	1	5	localInterruptedIOException1	InterruptedIOException
    //   126	1	6	localInterruptedIOException2	InterruptedIOException
    // Exception table:
    //   from	to	target	type
    //   7	19	19	finally
    //   25	34	37	java/io/InterruptedIOException
    //   114	123	126	java/io/InterruptedIOException
  }
  
  public void setIsCancellable(boolean cancellable)
  {
    this.cancellable = cancellable;
  }
  
  private boolean checkCancellation()
  {
    if (cancellable) {
      return monitor.isCanceled();
    }
    return false;
  }
}

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

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 IProgressMonitor monitor;
  private int updateIncrement;
  private 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/team/internal/core/streams/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/team/internal/core/streams/ProgressMonitorInputStream:update	(Z)V
    //   16: aload_1
    //   17: athrow
    //   18: aload_0
    //   19: iconst_1
    //   20: invokespecial 82	org/eclipse/team/internal/core/streams/ProgressMonitorInputStream:update	(Z)V
    //   23: return
    // Line number table:
    //   Java source line #60	-> byte code offset #0
    //   Java source line #61	-> byte code offset #10
    //   Java source line #62	-> byte code offset #11
    //   Java source line #63	-> byte code offset #16
    //   Java source line #62	-> byte code offset #18
    //   Java source line #64	-> 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.team.internal.core.streams.ProgressMonitorInputStream
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.team.internal.core.streams;

import java.io.FilterInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InterruptedIOException;

public class SizeConstrainedInputStream
  extends FilterInputStream
{
  private boolean discardOnClose;
  private long bytesRemaining;
  
  public SizeConstrainedInputStream(InputStream in, long size, boolean discardOnClose)
  {
    super(in);
    bytesRemaining = size;
    this.discardOnClose = discardOnClose;
  }
  
  /* Error */
  public void close()
    throws IOException
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 57	org/eclipse/team/internal/core/streams/SizeConstrainedInputStream:discardOnClose	Z
    //   4: ifeq +45 -> 49
    //   7: aload_0
    //   8: getfield 56	org/eclipse/team/internal/core/streams/SizeConstrainedInputStream:bytesRemaining	J
    //   11: lconst_0
    //   12: lcmp
    //   13: ifeq +36 -> 49
    //   16: aload_0
    //   17: aload_0
    //   18: getfield 56	org/eclipse/team/internal/core/streams/SizeConstrainedInputStream:bytesRemaining	J
    //   21: invokevirtual 64	org/eclipse/team/internal/core/streams/SizeConstrainedInputStream:skip	(J)J
    //   24: lconst_0
    //   25: lcmp
    //   26: ifne -19 -> 7
    //   29: goto +20 -> 49
    //   32: pop
    //   33: aload_0
    //   34: lconst_0
    //   35: putfield 56	org/eclipse/team/internal/core/streams/SizeConstrainedInputStream:bytesRemaining	J
    //   38: goto +16 -> 54
    //   41: astore_1
    //   42: aload_0
    //   43: lconst_0
    //   44: putfield 56	org/eclipse/team/internal/core/streams/SizeConstrainedInputStream:bytesRemaining	J
    //   47: aload_1
    //   48: athrow
    //   49: aload_0
    //   50: lconst_0
    //   51: putfield 56	org/eclipse/team/internal/core/streams/SizeConstrainedInputStream:bytesRemaining	J
    //   54: return
    // Line number table:
    //   Java source line #54	-> byte code offset #0
    //   Java source line #55	-> byte code offset #7
    //   Java source line #57	-> byte code offset #32
    //   Java source line #62	-> byte code offset #33
    //   Java source line #61	-> byte code offset #41
    //   Java source line #62	-> byte code offset #42
    //   Java source line #63	-> byte code offset #47
    //   Java source line #62	-> byte code offset #49
    //   Java source line #64	-> byte code offset #54
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	55	0	this	SizeConstrainedInputStream
    //   41	7	1	localObject	Object
    //   32	1	2	localOperationCanceledException	org.eclipse.core.runtime.OperationCanceledException
    // Exception table:
    //   from	to	target	type
    //   0	29	32	org/eclipse/core/runtime/OperationCanceledException
    //   0	33	41	finally
  }
  
  public int available()
    throws IOException
  {
    int amount = in.available();
    if (amount > bytesRemaining) {
      amount = (int)bytesRemaining;
    }
    return amount;
  }
  
  public int read()
    throws IOException
  {
    if (bytesRemaining == 0L) {
      return -1;
    }
    int b = in.read();
    if (b != -1) {
      bytesRemaining -= 1L;
    }
    return b;
  }
  
  public int read(byte[] buffer, int offset, int length)
    throws IOException
  {
    if (length > bytesRemaining)
    {
      if (bytesRemaining == 0L) {
        return -1;
      }
      length = (int)bytesRemaining;
    }
    try
    {
      int count = in.read(buffer, offset, length);
      if (count != -1) {
        bytesRemaining -= count;
      }
      return count;
    }
    catch (InterruptedIOException e)
    {
      bytesRemaining -= bytesTransferred;
      throw e;
    }
  }
  
  public long skip(long amount)
    throws IOException
  {
    if (amount > bytesRemaining) {
      amount = bytesRemaining;
    }
    try
    {
      long count = in.skip(amount);
      bytesRemaining -= count;
      return count;
    }
    catch (InterruptedIOException e)
    {
      bytesRemaining -= bytesTransferred;
      throw e;
    }
  }
  
  public boolean markSupported()
  {
    return false;
  }
}

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

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

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

import java.io.FilterInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InterruptedIOException;
import java.io.PrintStream;
import org.eclipse.team.internal.core.Policy;

public class TimeoutInputStream
  extends FilterInputStream
{
  private final long readTimeout;
  private final long closeTimeout;
  private boolean closeRequested = false;
  private Thread thread;
  private byte[] iobuffer;
  private int head = 0;
  private int length = 0;
  private IOException ioe = null;
  private boolean waitingForClose = false;
  private boolean growWhenFull = false;
  
  public TimeoutInputStream(InputStream in, int bufferSize, long readTimeout, long closeTimeout)
  {
    super(in);
    this.readTimeout = readTimeout;
    this.closeTimeout = closeTimeout;
    iobuffer = new byte[bufferSize];
    thread = new Thread(new Runnable()
    {
      public void run()
      {
        TimeoutInputStream.this.runThread();
      }
    }, "TimeoutInputStream");
    thread.setDaemon(true);
    thread.start();
  }
  
  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
  {
    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 int available()
    throws IOException
  {
  
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