We manage the Lossless WebP case

@param is The InputStream we're reading
@return The dimensions if any
@throws IOException In case or error reading from the InputStream
484895
private static @Nullable Pair<Integer, Integer> getVP8LDimension(final InputStream is)
      throws IOException {
    // Skip 4 bytes
    getInt(is);
    //We have a check here
    final byte check = getByte(is);
    if (check != 0x2F) {
      return null;
    }
    int data1 = ((byte) is.read()) & 0xFF;
    int data2 = ((byte) is.read()) & 0xFF;
    int data3 = ((byte) is.read()) & 0xFF;
    int data4 = ((byte) is.read()) & 0xFF;
    // In this case the bits for size are 14!!! The sizes are -1!!!
    final int width = ((data2 & 0x3F) << 8 | data1) + 1;
    final int height = ((data4 & 0x0F) << 10 | data3 << 2 | (data2 & 0xC0) >> 6) + 1;
    return new Pair<>(width, height);
  }
112172
public void readFrom(final InputStream in) throws IOException {
        pointer = 0;
        size = 0;
        int n;
        do {
            n = in.read(buffer, size, buffer.length - size);
            if (n > 0) {
                size += n;
            }
            resizeIfNeeded();
        } while (n >= 0);
    }
430329
private static String getStringFromInputStream(InputStream is)
    {
        BufferedReader br = null;
        StringBuilder sb = new StringBuilder();

        String line;
        try
        {
            br = new BufferedReader(new InputStreamReader(is));
            while((line = br.readLine()) != null)
            {
                sb.append(line);
            }

        }
        catch(IOException e)
        {
            logger.severe("Unable to get string from stream: "+e.getClass().getName()+": "+e.getMessage());
        }
        finally
        {
            try
            {
                if(br != null)
                    br.close();
            }
            catch(IOException e)
            {
            }
        }

        return sb.toString();
    }
310881
public static byte[] getBytes(InputStream is) throws IOException {
        ByteArrayOutputStream answer = new ByteArrayOutputStream();
        // reading the content of the file within a byte buffer
        byte[] byteBuffer = new byte[8192];
        int nbByteRead /* = 0*/;
        try {
            while ((nbByteRead = is.read(byteBuffer)) != -1) {
                // appends buffer
                answer.write(byteBuffer, 0, nbByteRead);
            }
        } finally {
            closeWithWarning(is);
        }
        return answer.toByteArray();
    }
351135
private static int read(InputStream is) throws IOException {
        int b = is.read();
        if (b == -1) {
            throw new EOFException();
        }
        return b;
    }
525857
@Trivial
    private static byte[] getBytes(InputStream stream, int knownSize) throws IOException {
        try {
            if (knownSize == -1) {
                ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
                try {
                    byte[] bytes = new byte[1024];
                    int read;
                    while (0 <= (read = stream.read(bytes)))
                        byteOut.write(bytes, 0, read);

                    return byteOut.toByteArray();
                } finally {
                    Util.tryToClose(byteOut);
                }
            } else {
                byte[] bytes = new byte[knownSize];
                int read;
                int offset = 0;
                while (knownSize > 0 && (read = stream.read(bytes, offset, knownSize)) > 0) {
                    offset += read;
                    knownSize -= read;
                }

                return bytes;
            }
        } finally {
            Util.tryToClose(stream);
        }
    }
912305
private static byte[] readClass(final InputStream is) throws IOException {
        if (is == null) {
            throw new IOException("Class not found");
        }
        byte[] b = new byte[is.available()];
        int len = 0;
        while (true) {
            int n = is.read(b, len, b.length - len);
            if (n == -1) {
                if (len < b.length) {
                    byte[] c = new byte[len];
                    System.arraycopy(b, 0, c, 0, len);
                    b = c;
                }
                return b;
            }
            len += n;
            if (len == b.length) {
                byte[] c = new byte[b.length + 1000];
                System.arraycopy(b, 0, c, 0, len);
                b = c;
            }
        }
    }
1227227
public static Object convertInputStreamToObject(InputStream is) throws IOException, ClassNotFoundException{
		ObjectInputStream ois = new ObjectInputStream(is);
		return ois.readObject();
	}
578562
protected int readFully(InputStream in, byte buffer[])
        throws java.io.IOException {
        for (int i = 0; i < buffer.length; i++) {
            int q = in.read();
            if (q == -1)
                return i;
            buffer[i] = (byte)q;
        }
        return buffer.length;
    }
222955
void readFrom(InputStream in) throws IOException {
		//TODO could optimize for aligned instances
		final int size = finish - start;
		final int length = (size + 7) >> 3;
		if (length == 0) return;
		int p = size & 7;
		final int q = finish - p;
		if (p != 0) performAdj(SET, q, (long) in.read(), p);
		p = q;
		while (p > start) {
			p -= 8;
			performAdj(SET, p, (long) in.read(), 8);
		}
	}
686540
protected int readShort(InputStream is) throws IOException
   {
      byte[] data = new byte[2];
      if (is.read(data) != data.length)
      {
         throw new EOFException();
      }

      return (MPPUtility.getShort(data, 0));
   }
1264627
public static String getText(InputStream is) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(is));
        return getText(reader);
    }
121981
public static Pcap openStream(final InputStream is, final int bufferCapacity) throws IOException {
        final Buffer stream = new BoundedInputStreamBuffer(bufferCapacity, is);
        final PcapGlobalHeader header = PcapGlobalHeader.parse(stream);
        return new Pcap(header, stream);
    }
663965
public boolean parseConstantPool(InputStream is)
    throws IOException
  {
    int count = readShort(is);
    
    _cpCount = count;
    
    if (_cpData == null || _cpData.length <= count) {
      _cpData = new int[count];
      _cpLengths = new int[count];
      _classData = new int[count];
    }
    
    Arrays.fill(_cpData, 0);
    Arrays.fill(_cpLengths, 0);
    Arrays.fill(_classData, 0);

    int i = 1;
    while (i < count) {
      int index = i;
      int code = is.read();

      if (code == ByteCodeParser.CP_LONG || code == ByteCodeParser.CP_DOUBLE)
        i += 2;
      else
        i += 1;
      
      switch (code) {
      case ByteCodeParser.CP_CLASS:
        int utf8Index = readShort(is);
        
        // index of the UTF-8 string
        _classData[index] = utf8Index;
        break;
      
      case ByteCodeParser.CP_FIELD_REF:
        // int classIndex = readShort();
        // int nameAndTypeIndex = readShort();

        is.skip(4);
        break;
      
      case ByteCodeParser.CP_METHOD_REF:
        // int classIndex = readShort();
        // int nameAndTypeIndex = readShort();

        is.skip(4);
        break;
      
      case ByteCodeParser.CP_INTERFACE_METHOD_REF:
        // int classIndex = readShort();
        // int nameAndTypeIndex = readShort();

        is.skip(4);
        break;

      case ByteCodeParser.CP_STRING:
        // int stringIndex = readShort();

        is.skip(2);
        break;
      
      case ByteCodeParser.CP_INTEGER:
        is.skip(4);
        break;
      
      case ByteCodeParser.CP_FLOAT:
        is.skip(4);
        break;
      
      case ByteCodeParser.CP_LONG:
        is.skip(8);
        break;
      
      case ByteCodeParser.CP_DOUBLE:
        is.skip(8);
        break;
      
      case ByteCodeParser.CP_NAME_AND_TYPE:
        // int nameIndex = readShort();
        // int descriptorIndex = readShort();

        is.skip(4);
        break;
      
      case ByteCodeParser.CP_UTF8:
        {
          int length = readShort(is);

          _cpData[index] = _charBufferOffset;
          _cpLengths[index] = parseUtf8(is, length);

          break;
        }
        
      case ByteCodeParser.CP_METHOD_HANDLE:
        is.skip(3);
        break;
        
      case ByteCodeParser.CP_METHOD_TYPE:
        is.skip(2);
        break;
        
      case ByteCodeParser.CP_INVOKE_DYNAMIC:
        is.skip(4);
        break;
        

      default:
        throw error(L.l("'{0}' is an unknown constant pool type.", code));
      }
    }

    return false;
  }
71761
function isStream(input) {
  if (ReadableStream.prototype.isPrototypeOf(input)) {
    return 'web';
  }
  if (NodeReadableStream && NodeReadableStream.prototype.isPrototypeOf(input)) {
    return 'node';
  }
  return false;
}
1195323
public static Symm obtain(InputStream is) throws IOException {
	  ByteArrayOutputStream baos = new ByteArrayOutputStream();
	  try {
		  base64url.decode(is, baos);
	  } catch (IOException e) {
		  // don't give clue
		  throw new IOException("Invalid Key");
	  }
	  byte[] bkey = baos.toByteArray();
	  if(bkey.length<0x88) { // 2048 bit key
		  throw new IOException("Invalid key");
	  }
	  return baseCrypt().obtain(bkey);
  }
245782
public static ByteArrayOutputStream input2OutputStream(final InputStream is) {
        if (is == null) return null;
        try {
            ByteArrayOutputStream os = new ByteArrayOutputStream();
            byte[]                b  = new byte[MemoryConst.KB];
            int                   len;
            while ((len = is.read(b, 0, MemoryConst.KB)) != -1) {
                os.write(b, 0, len);
            }
            return os;
        } catch (IOException e) {
            e.printStackTrace();
            return null;
        } finally {
            IOKit.closeQuietly(is);
        }
    }