Reads avro object from input stream.

@param inputStream The input stream to read from
@return Avro object
@throws IOException
342970
AvroMultiRuntimeAppSubmissionParameters fromInputStream(final InputStream inputStream) throws IOException {
    final JsonDecoder decoder = DecoderFactory.get().jsonDecoder(
            AvroMultiRuntimeAppSubmissionParameters.getClassSchema(), inputStream);
    final SpecificDatumReader<AvroMultiRuntimeAppSubmissionParameters> reader = new SpecificDatumReader<>(
            AvroMultiRuntimeAppSubmissionParameters.class);
    return reader.read(null, decoder);
  }
838721
public InputStream openStream() throws IOException {
        final SecurityManager sm = System.getSecurityManager();
        if (sm != null) {
            sm.checkPermission(new VirtualFilePermission(getPathName(), "read"));
        }
        if (isDirectory()) {
            return new VirtualJarInputStream(this);
        }
        final VFS.Mount mount = VFS.getMount(this);
        if (sm != null) {
            return doIoPrivileged(() -> mount.getFileSystem().openInputStream(mount.getMountPoint(), this));
        }
        return mount.getFileSystem().openInputStream(mount.getMountPoint(), this);
    }
441553
public static VcfHeader header(final InputStream inputStream) throws IOException {
        checkNotNull(inputStream);
        try (BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream))) {
            return header(reader);
        }
    }
106353
public static byte[] readBytes(InputStream in) throws IORuntimeException {
		final FastByteArrayOutputStream out = new FastByteArrayOutputStream();
		copy(in, out);
		return out.toByteArray();
	}
324122
public static String readFromInputStream(InputStream inputStream) {
        try {
            return IOUtils.toString(inputStream, Charset.forName("utf-8")).trim();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
1363863
private static byte[] readStream(final InputStream in) throws IOException {
    final ByteArrayOutputStream bos = new ByteArrayOutputStream();
    final byte[] data = new byte[4096];
    int bytesRead;
    while ((bytesRead = in.read(data, 0, data.length)) != -1) {
      bos.write(data, 0, bytesRead);
    }
    return bos.toByteArray();
  }
798655
public static <T> List<T> readValues(InputStream inputStream, Class<T> type) throws IOException {
        return DataModelSerializer.deserializeList(inputStream, type);
    }
246380
public void load(InputStream inputStream) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
        StringBuilder out = new StringBuilder();
        String line;

        while ((line = reader.readLine()) != null) {
            out.append(line);
            out.append(System.lineSeparator());
        }

        setScriptText(out.toString());
    }
962358
public byte[] drain(InputStream inputStream) throws IOException {
        List<byte[]> previousBytes = new ArrayList<byte[]>();
        byte[] currentArray = new byte[bufferSize];
        int currentIndex = 0;
        int currentRead;
        do {
            currentRead = inputStream.read(currentArray, currentIndex, bufferSize - currentIndex);
            currentIndex += currentRead > 0 ? currentRead : 0;
            if (currentIndex == bufferSize) {
                previousBytes.add(currentArray);
                currentArray = new byte[bufferSize];
                currentIndex = 0;
            }
        } while (currentRead != END_OF_STREAM);
        byte[] result = new byte[previousBytes.size() * bufferSize + currentIndex];
        int arrayIndex = 0;
        for (byte[] previousByte : previousBytes) {
            System.arraycopy(previousByte, FROM_BEGINNING, result, arrayIndex++ * bufferSize, bufferSize);
        }
        System.arraycopy(currentArray, FROM_BEGINNING, result, arrayIndex * bufferSize, currentIndex);
        return result;
    }
484428
public static ObjectInputStream gullibleObjectInputStream(InputStream is) throws IOException {
		return new ObjectInputStream(is) {
			@Override
			protected ObjectStreamClass readClassDescriptor() throws IOException, ClassNotFoundException {
				ObjectStreamClass oc = super.readClassDescriptor();
				try {
					Class<?> c = Class.forName(oc.getName());
					// interfaces do not have fields
					if (!c.isInterface()) {
						Field f = oc.getClass().getDeclaredField("suid");
						f.setAccessible(true);
						f.set(oc, ObjectStreamClass.lookup(c).getSerialVersionUID());
					}
				} catch (Exception e) {
					System.err.println("Couldn't fake class descriptor for "+oc+": "+ e);
				}
				return oc;
			}
		};
	}
98085
private InputStream dumpInputStream(InputStream is) {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        InputStream copiedStream = null;
        try {

            byte buf[] = new byte[2048];
            int len;
            while ((len = is.read(buf)) > 0) {
                baos.write(buf, 0, len);
            }
            byte[] streamBytes = baos.toByteArray();
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, " InputStream dump ", baos.toString());
            }

            copiedStream = new ByteArrayInputStream(streamBytes);

            is.close();
        } catch (IOException e) {
            // an IOException here will mean that we screwed up the original stream
            // we'll need to return null and the caller will need to attempt to
            // re-obtain the stream
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, " InputStream dump failed ", e);
            }
            FFDCFilter.processException(e, CLASS_NAME + ".dumpInputStream", "630");

        } finally {
            try {
                baos.close();
            } catch (IOException e) {
                //AutoFFDC
            }
        }
        return copiedStream;

    }
996309
public static FastByteArrayOutputStream read(InputStream in) throws IORuntimeException {
		final FastByteArrayOutputStream out = new FastByteArrayOutputStream();
		copy(in, out);
		return out;
	}
1012014
public void load(InputStream inputStream)
	{

		try (BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream)))
		{
			while ((currentLine = reader.readLine()) != null)
			{
				lineNumber++;
				currentLine = currentLine.replaceAll("\\s+", " ").trim();
				matcher = linePattern.matcher(currentLine);

				if (matcher.matches())
				{
					String type = matcher.group("type");
					String data = matcher.group("data");

					switch (type)
					{
						case "v":
							addVertex(data);
							break;
						case "vn":
							addNormal(data);
							break;
						case "vt":
							addUV(data);
							break;
						case "f":
							addFace(data);
							break;
						case "g":
						case "o":
							addShape(data);
							break;

						default:
							MalisisCore.log.debug("[ObjFileImporter] Skipped type {} at line {} : {}", type, lineNumber, currentLine);
							break;
					}
				}
				else
				{
					MalisisCore.log.debug("[ObjFileImporter] Skipped non-matching line {} : {}", lineNumber, currentLine);
				}
			}

			addShape("");
		}
		catch (Exception e)
		{
			MalisisCore.log.error("[ObjFileImporter] An error happened while reading the file : {}", e);
		}
	}
1017394
@Override
    public InputStream getInputStream() throws IOException {
	if (barr == null) {
	    barr = IOUtil.toBytes(url.openStream());
	}
	return new ByteArrayInputStream(barr);
    }
706662
public static String readInputStreamToString( InputStream inputStream ) {

        try {
            // Create the byte list to hold the data
            List<Byte> bytesList = new ArrayList<Byte>();

            byte b = 0;
            while( (b = (byte) inputStream.read()) != -1 ) {
                bytesList.add(b);
            }
            // Close the input stream and return bytes
            inputStream.close();

            byte[] bArray = new byte[bytesList.size()];
            for( int i = 0; i < bArray.length; i++ ) {
                bArray[i] = bytesList.get(i);
            }

            String file = new String(bArray);
            return file;
        } catch (IOException e) {
            e.printStackTrace();
            return null;
        }
    }
1256076
public static <T> T readValue(InputStream inputStream, Class<T> type) throws IOException, BadVersionException {
        return DataModelSerializer.deserializeObject(inputStream, type);
    }
535176
private Object deserialize(InputStream byteStream) throws IOException, ClassNotFoundException {
        ObjectInputStream in = new ObjectInputStream(byteStream);
        try {
            return in.readObject();
        } finally {
            in.close();
        }
    }