Java 8 BufferedInputStream - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 BufferedInputStream class.

This code example shows how to use the following methods:close
    Map<String, ProcessingInstructionNode> getSocketBindingsPlaceHolders() {
        return socketBindingsPlaceHolder;
    } 
 
    void parse() throws IOException, XMLStreamException { 
        InputStream in = new BufferedInputStream(new FileInputStream(inputFile));
        try { 
            XMLInputFactory factory = XMLInputFactory.newInstance();
            factory.setProperty(XMLInputFactory.IS_COALESCING, Boolean.FALSE);
            XMLStreamReader reader = factory.createXMLStreamReader(in);
 
            reader.require(START_DOCUMENT, null, null);
            ParsingUtils.getNextElement(reader, rootElementName, null, false);
            root = super.parseNode(reader, rootElementName);
 
        } finally { 
            try { 
                in.close();
            } catch (Exception ignore) {
            } 

9
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:mark, markSupported, read, reset
 
        byte [] bytes = marshallThingy(thingy);
 
         
        ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
        BufferedInputStream bis = new BufferedInputStream(bais);
        ObjectInputStream stream = new ObjectInputStream(bis);
 
        DataObject unmaThingy = new DataObject();
        unmaThingy.type = stream.readChar();
        unmaThingy.time = stream.readLong();
         
        assertTrue( "Mark/reset is not supported", bis.markSupported() );
        bis.mark(8);
        int [] intBytes = new int [4];
        intBytes[0] = bis.read();
        intBytes[1] = bis.read();
        intBytes[2] = bis.read();
        intBytes[3] = bis.read();
        if ((intBytes[0] | intBytes[1] | intBytes[2] | intBytes[3] ) < 0) { 

8
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
        final FileInputStream is = new FileInputStream(file);
        try { 
            final String entryName = parent == null ? file.getName() : parent + "/" + file.getName();
            zos.putNextEntry(new ZipEntry(entryName));
 
            final BufferedInputStream bis = new BufferedInputStream(is);
            try { 
                copyStream(bis, zos);
            } finally { 
                safeClose(bis);
            } 
 
            zos.closeEntry();
        } finally { 
            safeClose(is);
        } 
    } 
 
    /** 
     * unpack... 
8
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:close
        Properties props = new Properties();
 
        File file = new File(getUserHome(), JLINE_RC);
        if (file.exists() && file.canRead()) {
            try { 
                InputStream input = new BufferedInputStream(new FileInputStream(file));
                try { 
                    props.load(input);
                    Log.debug("Loaded user configuration: ", file);
                } 
                finally { 
                    input.close();
                } 
            } 
            catch (IOException e) {
                Log.warn("Unable to read user configuration: ", file, e);
            } 
        } 
        else { 
            Log.trace("User configuration file missing or unreadable: ", file);
8
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:close
 
  private File obtainRootDirectory(File extensionToInstall) throws IOException {
    File root = extensionToInstall;
    if (!extensionToInstall.isDirectory()) {
      BufferedInputStream bis =
          new BufferedInputStream(new FileInputStream(extensionToInstall));
      try { 
        root = FileHandler.unzip(bis);
      } finally { 
        bis.close();
      } 
    } 
    return root;
  } 
 
 
  private String readIdFromInstallRdf(File root) {
    try { 
      File installRdf = new File(root, "install.rdf");
 
8
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
   */ 
  public static BlockMetadataHeader readHeader(File file) throws IOException {
    DataInputStream in = null;
    try { 
      in = new DataInputStream(new BufferedInputStream(
                               new FileInputStream(file)));
      return readHeader(in);
    } finally { 
      IOUtils.closeStream(in);
    } 
  } 
   
  /** 
   * Read the header at the beginning of the given block meta file. 
   * The current file position will be altered by this method. 
   * If an error occurs, the file is <em>not</em> closed. 
   */ 
  static BlockMetadataHeader readHeader(RandomAccessFile raf) throws IOException {
    byte[] buf = new byte[getHeaderSize()];
    raf.seek(0);
8
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:decodeStream
        BitmapFactory.Options options = new BitmapFactory.Options();
        options.inJustDecodeBounds = true;
 
        BufferedInputStream stream = null;
        try { 
            stream = new BufferedInputStream(new FileInputStream(file));
            BitmapFactory.decodeStream(stream, null, options);
        } catch (FileNotFoundException e) {
            Log.e("HtmlImage.setSampleSize", e);
        } finally { 
            IOUtils.closeQuietly(stream);
        } 
 
        int scale = 1;
        if (options.outHeight > maxHeight || options.outWidth > maxWidth) {
            scale = Math.max(options.outHeight / maxHeight, options.outWidth / maxWidth);
        } 
        bfOptions.inSampleSize = scale;
    } 
 
8
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
	 * @throws IOException in case of I/O errors 
	 */ 
	public static int copy(File in, File out) throws IOException {
		Assert.notNull(in, "No input File specified");
		Assert.notNull(out, "No output File specified");
		return copy(new BufferedInputStream(new FileInputStream(in)),
			new BufferedOutputStream(new FileOutputStream(out)));
	} 
 
	/** 
	 * Copy the contents of the given byte array to the given output File. 
	 * @param in the byte array to copy from 
	 * @param out the file to copy to 
	 * @throws IOException in case of I/O errors 
	 */ 
	public static void copy(byte[] in, File out) throws IOException {
		Assert.notNull(in, "No input byte array specified");
		Assert.notNull(out, "No output File specified");
		ByteArrayInputStream inStream = new ByteArrayInputStream(in);
		OutputStream outStream = new BufferedOutputStream(new FileOutputStream(out));
8
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:decodeStream
				URL aURL = new URL(url);
				URLConnection conn = aURL.openConnection();
 
				conn.connect();
 
				is = new BufferedInputStream(conn.getInputStream());
 
				return BitmapFactory.decodeStream(is);
			} catch (IOException e) {
				AphidLog.e(e, "Failed to load bitmap from url: " + url);
			} finally { 
				IO.close(is);
			} 
 
			return null; 
		} 
 
		@Override 
		protected void onPostExecute(Bitmap result) {
			if (isCancelled())
8
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
public class FileCopyWithProgress { 
  public static void main(String[] args) throws Exception {
    String localSrc = args[0];
    String dst = args[1];
     
    InputStream in = new BufferedInputStream(new FileInputStream(localSrc));
     
    Configuration conf = new Configuration();
    FileSystem fs = FileSystem.get(URI.create(dst), conf);
    OutputStream out = fs.create(new Path(dst), new Progressable() {
      public void progress() { 
        System.out.print(".");
      } 
    }); 
     
    IOUtils.copyBytes(in, out, 4096, true);
  } 
} 
// ^^ FileCopyWithProgress 
8
CodeRank
Experience pair programming with AI  Get Codota for Java

Related Java 8 BufferedInputStream Questions & Answers:

Other Java 8 BufferedInputStream Examples

27:		            // input stream to read file - with 8k buffer
28:		            InputStream input = new BufferedInputStream(url.openStream(), 8192);
29:	
30:		            // Output stream to write file
31:		            OutputStream output = new FileOutputStream("/sdcard/downloadedfile.jpg");

Read More

104:		            // download the file
105:		            InputStream input = new BufferedInputStream(url.openStream(), 8192);
106:	
107:		            // Output stream
108:		            OutputStream output = new FileOutputStream("/sdcard/downloadedfile.jpg");

Read More

See Code Examples for Java 8 BufferedInputStream Methods: