× Image Not found NEW UPDATES INTERVIEW QUESTIONS c c++ c# java python html css php RDBMS sql javascript jquery bootstrap datastructures & ALGORITHMS webservices cloud computing datascience ARTIFICIAL INTELLIGENCE GIT AWS json ios android spring hibernate maven Microservices ANGULAR BLOCKCHAIN
TECHNOLOGIES
Image Not found
KNOWLEDGE2LIFE
  • C
  • C++
  • C#
  • JAVA
  • Python
  • HTML
  • CSS
  • php
  • RDBMS
  • SQL
  • JAVASCRIPT
  • JQUERY
  • bootstrap
    INTERVIEW QUESTIONS
  • DATASTRUCTURES & ALGORITHMS
  • WEBSERVICES
  • CLOUD computing
  • DATAScience
  • ARTIFICIAL INTELLIGENCE
  • NEW UPDATES
  • GIT
  • AWS
  • JSON
  • IOS
  • ANDROID
  • SPRING
  • HIBERNATE
  • MAVEN
  • Microservices
  • ANGULAR
  • BLOCKCHAIN

JAVA TOPICS

    JAVA BASICS
    • Java introduction (current)
    • IDE installation (current)
    • Hello world (current)
    • JRE, JDK, JVM (current)
    • Data types (current)
    • Variables (current)
    • Operator (current)
    • Keywords (current)
    • Comments (current)
    CONTROL STATEMENTS
    • Condition Statements (current)
    • IF else (current)
    • Switch (current)
    • While(Custom) (current)
    • For loop (current)
    • Break, Continue (current)
    OOPS(Object oriented programming)
    • Class (current)
    • Method (current)
    • Constructor (current)
    • Object (current)
    • This (current)
    • Super (current)
    • Static (current)
    • Final (current)
    • Inheritance (current)
    • Polymorphism (current)
    • Method overloading (current)
    • Method overriding (current)
    • Runtime-polymorphism (current)
    • Abstraction (current)
    • Interface (current)
    • Loose coupling and Tight Couple (current)
    • Access Modifiers (current)
    • Encapsulation (current)
    • Array (current)
    String
    • String (current)
    • String methods (current)
    • String Buffer (current)
    • String Builder (current)
    • Immutable string (current)
    Exception Handling
    • Java Exception (current)
    • Try catch (current)
    • Finally (current)
    • Throw (current)
    • Throws (current)
    • Custom Exception (current)
    Multithreading
    • Java Multithreading (current)
    • Creating Thread (current)
    • Thread scheduler (current)
    • Sleeping thread (current)
    • Daemon Thread (current)
    • Threadpool (current)
    • ThreadGroup (current)
    • Multi-tasking (current)
    • Garbage collector (current)
    • Interthread communication (current)
    • Synchronization (current)
    • Deadlock (current)
    Java Input Output
    • Java InputOutput (current)
    • BufferedStream Input (current)
    • BufferedStream Output (current)
    • File permission (current)
    • Writer (current)
    • Reader (current)
    • File Reader and File Writer (current)
    • Buffered Reader and Buffered Writer (current)
    • InputStream reader and InputStream writer (current)
    • Serialization (current)
    • Scanner (current)
    • PrintStream and Printwriter (current)
    • File (current)
    • FileDescriptor (current)
    COLLECTIONS
    • Java Collection (current)
    • Arraylist (current)
    • Linkedlist (current)
    • List interface (current)
    • Hashtable (current)
    • Tree (current)
    • Map (current)
    • Enum (current)
    • Stack (current)
    • Vector (current)
JAVA TOPICS

JAVA TOPICS

JAVA BASICS
    Java introduction IDE installation Hello world JRE, JDK, JVM Data types Variables Operator Keywords Comments
CONTROL STATEMENTS
    Condition Statements IF else Switch While(Custom) For loop Break, Continue
OOPS(Object oriented programming)
    Class Method Constructor Object This Super Static Final Inheritance Polymorphism Method overloading Method overriding Runtime-polymorphism Abstraction Interface Loose coupling and Tight Couple Access Modifiers Encapsulation Array
String
    String String methods String Buffer String Builder Immutable string
Exception Handling
    Java Exception Try catch Finally Throw Throws Custom Exception
Multithreading
    Java Multithreading Creating Thread Thread scheduler Sleeping thread Daemon Thread Threadpool ThreadGroup Multi-tasking Garbage collector Interthread communication Synchronization Deadlock
Java Input Output
    Java InputOutput BufferedStream Input BufferedStream Output File permission Writer Reader File Reader and File Writer Buffered Reader and Buffered Writer InputStream reader and InputStream writer Serialization Scanner PrintStream and Printwriter File FileDescriptor
COLLECTIONS
    Java Collection Arraylist Linkedlist List interface Hashtable Tree Map Enum Stack Vector

Buffered Input Stream


Buffered Input Stream

This class is used to read information from stream. To make the performance fast, it internally uses buffer mechanism. Internal buffer array gets created when a BufferedInputStream is created.

Syntax for declaring java.io.BufferedInputStream class:

public class BufferedInputStream extends FilterInputStream

Example:

Create a text file named text1 in D drive with following data(Any data can be written):
I love Coding!!
Save and test the program for the execution.

Points to be noted in Buffered Input Stream

An array is internally created during the creation of BufferedInputStream

While reading the bytes, array internally is filled automatically if the bytes are skipped

Class declaration:

Following is the syntax for java.io.BufferedInputStream class is

public class BufferedInputStream extends FilterInputStream

Constructors in Java BufferedInputStream

Constructor

Short Description of the constructor

BufferedInputStream(InputStream IS)

Creation of BufferedInputStream

BufferedInputStream(InputStream IS, int size)

Creation of BufferedInputStream with definite size


Methods in BufferedInputStream

Name of Method

Short Description of the method

int read( )

To read the data from the input stream

int available()

Returns the estimation of available bytes

int read(byte[] b, int off, int In)

Read the specified byte type into a specified byte array

void close()

Performs close and release the resource utilized by it

void reset()

It place back the stream in the previously called position

Example :

import java.io.*; public class BufferedInputStreamExample{ public static void main(String args[]){ try{ FileInputStream fin=new FileInputStream("knowledge2life.txt"); BufferedInputStream bin=new BufferedInputStream(fin); int i; while((i=bin.read())!=-1){ System.out.print((char)i); } bin.close(); fin.close(); }catch(Exception e){System.out.println(e);} } }

OUTPUT:

Knowledge2life

GET IN TOUCH

  • HYDERABAD
  • (+91) 91545 65150
  • info@Knowledge2life.com

SOCIAL MEDIA

LATEST UPATE

  • Javascript
  • Hibernate
  • SPRING
  • Blockchain
  • Datascience
  • Android

UPCOMING

  • AI
  • IOS
  • AWS
  • Datastructures
  • Cloud computing
  • Algorithms
STAY UPDATED
©Copyrights 2021 reserved by K2l Infotech Private Limited
  • About us
  • Privacy Policy
  • Terms & Conditions
  • Contact us