Package java.io

Examples of java.io.PushbackInputStream.unread()


                    new FileInputStream(defectLogFilename));
        int c = pin.read();
        if (c == -1) { // empty file
            ;
        } else if (c == '<') { // xml format
            pin.unread(c);
            results = readDefectsFromXml(pin);
        } else { // tab-delimited format
            pin.unread(c);
            results = readTabDelimitedDefects(pin);
        }
View Full Code Here


            ;
        } else if (c == '<') { // xml format
            pin.unread(c);
            results = readDefectsFromXml(pin);
        } else { // tab-delimited format
            pin.unread(c);
            results = readTabDelimitedDefects(pin);
        }
    } catch (FileNotFoundException f) {
      System.out.println("FileNotFoundException: " + f);
    } catch (SAXException i) {
View Full Code Here

    throw new IllegalArgumentException("The document is really a RTF file");
  }

  // OK, so it's not RTF
  // Open a POIFSFileSystem on the (pushed back) stream
  pis.unread(first6);
  return new POIFSFileSystem(pis);
  }

  /**
   * This constructor loads a Word document from an InputStream.
View Full Code Here

        LongField signature = new LongField(HeaderBlockConstants._signature_offset, header);

        // Wind back those 8 bytes
        if(inp instanceof PushbackInputStream) {
            PushbackInputStream pin = (PushbackInputStream)inp;
            pin.unread(header);
        } else {
            inp.reset();
        }

        // Did it match the signature?
View Full Code Here

    throw new IllegalArgumentException("The document is really a RTF file");
  }

  // OK, so it's not RTF
  // Open a POIFSFileSystem on the (pushed back) stream
  pis.unread(first6);
  return new POIFSFileSystem(pis);
  }

  /**
   * This constructor loads a Word document from an InputStream.
View Full Code Here

      tempOut.writeUTF(marker);
     
      byte[] bytesToPutBack = tempByteOut.toByteArray();
     
      PushbackInputStream pushbackStream = new PushbackInputStream(in, bytesToPutBack.length);
      pushbackStream.unread(bytesToPutBack);
     
      return pushbackStream;
    }
   
  }
View Full Code Here

      encoding = defaultEncoding;
      unread = n;
    }

    if (unread > 0)
      tempIn.unread(bom, (n - unread), unread);
    else if (unread < -1)
      tempIn.unread(bom, 0, 0);

    // Use given encoding
    if (encoding == null) {
View Full Code Here

    }

    if (unread > 0)
      tempIn.unread(bom, (n - unread), unread);
    else if (unread < -1)
      tempIn.unread(bom, 0, 0);

    // Use given encoding
    if (encoding == null) {
      internalIn = new InputStreamReader(tempIn);
      encoding = internalIn.getEncoding(); // Get the default.
View Full Code Here

          // LF
        } else if (c == 13) {
          // CR
          c = f.read();// fgetc(f);
          if (c != 10)
            f.unread(c);// ungetc (c,f);
        } else
          f.unread(c);// ungetc (c,f);

        // read in rest of data
        // image_data = new byte [image_width*image_height*3];
 
View Full Code Here

          // CR
          c = f.read();// fgetc(f);
          if (c != 10)
            f.unread(c);// ungetc (c,f);
        } else
          f.unread(c);// ungetc (c,f);

        // read in rest of data
        // image_data = new byte [image_width*image_height*3];
        image_data = BufferUtils.createByteBuffer(image_width
            * image_height * 3);
 
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.