Results 1 to 6 of 6

Thread: Content of BufferedInputStream

  1. #1
    Join Date
    Dec 2009
    Posts
    213

    Content of BufferedInputStream

    Hello,
    I have small query, I want to know how to display the contents of a BufferedInputStream.
    BufferedInputStream bis = new BufferedInputStream(new FileOutputStream(filename));
    then write in the buffer using the method
    bis.write();
    I would like to view the content of the file filename. Thank you in advance.
    Last edited by Aaliya Seth; 28-01-2010 at 02:20 PM.

  2. #2
    Join Date
    Feb 2008
    Posts
    1,852

    Re: Content of BufferedInputStream

    Hi
    If you want to read the contents of the file, just follow this
    BufferedIntputStream bis = new BufferedIntputStream(new FileIntputStream(filename),500);
    And then
    bis.read();
    without forgetting to close the buffer.
    bis.close()
    This will ensure that the buffer is properly closed.

  3. #3
    Join Date
    Dec 2009
    Posts
    213

    Re: Content of BufferedInputStream

    Hello,
    I tried bis.read function () but it can not read my file, I think the problem is that writing is not made or every time I write a character, it is overwritten by the next. Does anyone have an idea about the working principle of the function bis.write () or a possible cause to my problem? Thank you. If there is any alternative method to read the content then please do post back.

  4. #4
    Join Date
    May 2008
    Posts
    2,297

    Re: Content of BufferedInputStream

    Hello,
    I think that you have not flushed your data, that is have you used the following method in your code.
    bsi.flush();
    You have to do this after the method, that is after you have written the data to the destination.
    bsi.write();

  5. #5
    Join Date
    Dec 2009
    Posts
    213

    Re: Content of BufferedInputStream

    Hello,
    I have not understood your question but here is the code I use
    Code:
     int i, j =0;	
     while ((i = bis.read()) != -1) {
    		while(fn == false)	
    		{
    			if (tab[j][j] ! = I)
    			{
    				j + +;
    			}
    			
    			else
    			{
    				fn = true;
    bis.write(tab[j][j+1]);
    bis.flush();
    	
    			}
    			
    		}
    		}
    		
    	BufferedInputStream bis1 = new BufferedInputStream(new FileInputStream(StrComp)); 
    	int k = 0;
        while ((k = bis1.read()) != -1) {
        	bis1.read();
        }

  6. #6
    Join Date
    May 2008
    Posts
    2,012

    Re: Content of BufferedInputStream

    Hello,
    Well I assume you have two files myfile and myfile2.
    BufferedInputStream bis = new BufferedInputStream(new FileInputStream(test));
    BufferedInputStream biscomp = new BufferedInputStream(new FileOutputStream(test2));
    to be clean if you can test your way str is valid. After you read in a but what do with it.
    if (tab[x][x] ! = I)
    {
    x + +;
    }

Similar Threads

  1. Content blocker blocks content on certain sites with Opera
    By GiveNTake in forum Technology & Internet
    Replies: 5
    Last Post: 21-06-2011, 07:30 AM
  2. How to use CSS content boxes
    By Botan in forum Software Development
    Replies: 1
    Last Post: 08-01-2011, 12:18 PM
  3. How to generate content with CSS
    By Eshita The Techie in forum Software Development
    Replies: 5
    Last Post: 08-01-2011, 11:54 AM
  4. How to fix the Content Advisor.
    By leshaspar in forum Technology & Internet
    Replies: 4
    Last Post: 06-11-2010, 07:47 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,711,628,169.67625 seconds with 17 queries