Creates an InputReader
@param input
@param size Ringbuffer size
@return
@throws IOException
339697
protected static InputReader getInput(InputSource input, int size, Charset cs, Set<ParserFeature> fea) throws IOException
    {
        EnumSet<ParserFeature> features = EnumSet.of(UseInclude, UsePushback, UseModifiableCharset);
        InputReader inputReader = null;
        Reader reader = input.getCharacterStream();
        if (reader != null)
        {
            inputReader = new ReadableInput(getFeaturedReader(reader, size, features), size, features);
        }
        else
        {
            InputStream is = input.getByteStream();
            String encoding = input.getEncoding();
            if (is != null)
            {
                if (encoding != null)
                {
                    inputReader = getInstance(is, size, encoding, features);
                }
                else
                {
                    inputReader = getInstance(is, size, StandardCharsets.US_ASCII, features);
                }
            }
            else
            {
                String sysId = input.getSystemId();
                try
                {
                    URI uri = new URI(sysId);
                    if (encoding != null)
                    {
                        inputReader = getInstance(uri, size, encoding, features);
                    }
                    else
                    {
                        inputReader = getInstance(uri, size, StandardCharsets.US_ASCII, features);
                    }
                }
                catch (URISyntaxException ex)
                {
                    throw new IOException(ex);
                }
            }
        }
        inputReader.setSource(input.getSystemId());
        return inputReader;
    }
1191908
private void openInputFile(final String inputFileName) throws IOException
	{
		myInputFile = new File(inputFileName);
		myInputStream = new FileInputStream(myInputFile);
		myStreamReader = new InputStreamReader(myInputStream, getInputEncodingCode());
		myBufferedReader = new BufferedReader(myStreamReader);
		myLineReader = new LineNumberReader(myBufferedReader);
	}
1024188
public static String absorbInputStream(InputStream input) throws IOException {
		byte[] bytes = StreamSupport.absorbInputStream(input);
		return new String(bytes);
	}
1194084
@SuppressWarnings("PMD.AssignmentInOperand")
    private static byte[] asBytes(final InputStream input) throws IOException {
        input.reset();
        try (ByteArrayOutputStream output = new ByteArrayOutputStream()) {
            // @checkstyle MagicNumberCheck (1 line)
            final byte[] buffer = new byte[1024];
            int read;
            while ((read = input.read(buffer, 0, buffer.length)) != -1) {
                output.write(buffer, 0, read);
            }
            output.flush();
            return output.toByteArray();
        }
    }
181154
@Override
    public ImageHeader readHeader(InputStream input) throws IOException
    {
        final int toSkip = 15 + 3;
        long skipped = input.skip(toSkip);
        checkSkippedError(skipped, toSkip);

        final int width = readInt(input, 2, false);
        skipped = input.skip(2);
        checkSkippedError(skipped, 2);

        final int height = readInt(input, 2, false);

        return new ImageHeaderModel(width, height, ImageFormat.BMP);
    }
1281271
public IndexInput openInput(String name, int bufferSize) throws IOException {
    return new FileSystemIndexInput(new Path(directory, name), bufferSize);
  }
431997
@Override
  public InStore openRead(long address, int size)
  {
    if (fileSize() < address + size) {
      throw new IllegalStateException(L.l("{0} read open for length {1}:{2} but file length {3}",
                                this, address, size, fileSize()));
    }

    if (_isClosed.get()) {
      throw new IllegalStateException(L.l("{0} is closed.", this));
    }
    
    if (_fileSize < address + size) {
      throw new IllegalStateException(L.l("Open read of large file {0}:{1}",
                                          Long.toHexString(address), size));
    }
    
    try {
      streamOpen(address, size);
      
      return openReadImpl(address, size);
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
  }
655223
@Override
    public ImageHeader readHeader(InputStream input) throws IOException
    {
        final int headBytes = 3 + 3;
        final long skipped = input.skip(headBytes);
        checkSkippedError(skipped, headBytes);

        final int width = readInt(input, 2, false);
        final int height = readInt(input, 2, false);
        final ImageFormat format = ImageFormat.GIF;

        return new ImageHeaderModel(width, height, format);
    }
98394
@GwtIncompatible("InputStream")
  static InputStream asInputStream(final ByteInput input) {
    checkNotNull(input);
    return new InputStream() {
      @Override
      public int read() throws IOException {
        return input.read();
      }

      @Override
      public int read(byte[] b, int off, int len) throws IOException {
        checkNotNull(b);
        checkPositionIndexes(off, off + len, b.length);
        if (len == 0) {
          return 0;
        }
        int firstByte = read();
        if (firstByte == -1) {
          return -1;
        }
        b[off] = (byte) firstByte;
        for (int dst = 1; dst < len; dst++) {
          int readByte = read();
          if (readByte == -1) {
            return dst;
          }
          b[off + dst] = (byte) readByte;
        }
        return len;
      }

      @Override
      public void close() throws IOException {
        input.close();
      }
    };
  }
1146034
public void setInput(final byte[] input)
	{

		if (input[0] == -128) {
			r = new BitReader(inflateInput(input, 1));
		}
		else {
			r = new BitReader(input);
		}
	}
105417
function(size) {
    var match;
    var buffer;
    if (match = size.match(/(\d+)KB/)) {
      buffer = new Buffer(parseInt(match[1]) * 1024);
    } else if (match = size.match(/(\d+)MB/)) {
      buffer = new Buffer(parseInt(match[1]) * 1024 * 1024);
    } else {
      switch (size) {
        case 'empty': buffer = new Buffer(0); break;
        case 'small': buffer = new Buffer(1024 * 1024); break;
        case 'large': buffer = new Buffer(1024 * 1024 * 20); break;
        default: return new Buffer(1024 * 1024);
      }
    }
    buffer.fill('x');
    return buffer;
  }
1002673
public static Observable<byte[]> from(InputStream is, int size) {
        return Observable.create(new OnSubscribeInputStream(is, size));
    }
146240
public static int[] getImageSize(InputStream input) throws IOException
    {
        try {
            ImageInputStream imageInput = ImageIO.createImageInputStream(input);
            BufferedImage image = ImageIO.read(imageInput);
            return new int[]{image.getWidth(), image.getHeight()};
        } finally {
            input.close();
        }
    }
525071
private Input processRegularFileInput(String input) throws IOException {
    File inputFile = new File(input);
    if (!inputFile.exists()) {
      throw new IOException("Input does not exist: " + input);
    }
    if (pipeFiles) {
      SamReader samReader = SamReaderFactory.makeDefault().open(inputFile);
      return new Input(input, STDIN_FILE_NAME, 
          new SamReaderToSAMFilePump(samReader)); 
    } else {
      return new Input(input, input, null);
    }
  }
75891
public static byte[] readbytes(InputStream input, int n) throws IOException {
		byte[] buffer = new byte[n];
		readbytes_into(input, buffer, 0, n);
		return buffer;
	}
1327832
public void setInput(final String input)
		throws DecodingException
	{

		boolean zipFlag = input.charAt(0) == '_';
		if (zipFlag) {
			r = new BitReader(inflateInput(
					Base64.decodeBase64(input.substring(1)), 0));
		}
		else {
			byte[] data = Base64.decodeBase64(input);
			if (data == null) {

				for (int i = 0; i < input.length(); i++) {
					System.err.println(i + ": " + (int) input.charAt(i)
							+ " <> " + input.charAt(i));
				}

				throw new DecodingException("BASE 64 DECODING FAILED: " + input);
			}
			r = new BitReader(data);
		}
	}
582335
private static Map<String, Object> readMap(StreamingInput input)
		throws IOException
	{
		boolean readEnd = false;
		if(input.peek() == Token.OBJECT_START)
		{
			// Check if the object is wrapped
			readEnd = true;
			input.next();
		}

		Token t;
		Map<String, Object> result = new HashMap<String, Object>();
		while((t = input.peek()) != Token.OBJECT_END && t != null)
		{
			// Read the key
			input.next(Token.KEY);
			String key = input.getString();

			// Read the value
			Object value = readDynamic(input);

			result.put(key, value);
		}

		if(readEnd)
		{
			input.next(Token.OBJECT_END);
		}

		return result;
	}