Package java.io

Examples of java.io.PushbackInputStream.unread()


        {
            try
            {
                PushbackInputStream pushbackStream = new PushbackInputStream((InputStream)src);
                int firstByte = pushbackStream.read();
                pushbackStream.unread((byte)firstByte);
               
                if (this.checkStreamHeader((byte)firstByte))
                {
                    return super.doTransform(pushbackStream, encoding);
                }
View Full Code Here


            result.setPayload(pb);
           
            int b = pb.read();
            if (b != -1)
            {
                pb.unread(b);
                return pb;
            }
        }
       
        return null;
View Full Code Here

      IOUtils.readFully(inp, header);

        // Wind back those 4 bytes
        if(inp instanceof PushbackInputStream) {
          PushbackInputStream pin = (PushbackInputStream)inp;
          pin.unread(header);
        } else {
          inp.reset();
        }
     
      // Did it match the ooxml zip signature?
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

        IOUtils.readFully(inp, header);

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

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

            /*
             * We read something without a problem, so it's a valid zlib stream. Just need to reset
             * and return an unused InputStream now.
             */
            pushback.unread(peeked, 0, headerLength);
            return new DeflateStream(pushback, new Inflater());
        } catch (final DataFormatException e) {

            /* Presume that it's an RFC1951 deflate stream rather than RFC1950 zlib stream and try
             * again. */
 
View Full Code Here

            return new DeflateStream(pushback, new Inflater());
        } catch (final DataFormatException e) {

            /* Presume that it's an RFC1951 deflate stream rather than RFC1950 zlib stream and try
             * again. */
            pushback.unread(peeked, 0, headerLength);
            return new DeflateStream(pushback, new Inflater(true));
        } finally {
            inf.end();
        }
    }
View Full Code Here

        try {
            PushbackInputStream pin =
                new PushbackInputStream(connection.getInputStream());
            int c = pin.read();
            if (c != -1) {
                pin.unread((byte)c);
                in = pin;
            }
        } catch (IOException ioe) {
            // ignore
        }   
View Full Code Here

        IOUtils.readFully(inp, header);

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

        // Did it match the ooxml zip signature?
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.