Package java.io

Examples of java.io.PushbackInputStream.unread()


        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


        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

                } else {
                    unread = n;
                }

                if (unread > 0) {
                    pushbackInputStream.unread(bom, (n - unread), unread);
                } else if (unread < -1) {
                    pushbackInputStream.unread(bom, 0, 0);
                }

                inputStream = pushbackInputStream;
View Full Code Here

                }

                if (unread > 0) {
                    pushbackInputStream.unread(bom, (n - unread), unread);
                } else if (unread < -1) {
                    pushbackInputStream.unread(bom, 0, 0);
                }

                inputStream = pushbackInputStream;
            }
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

                        break;
                    case 92:
                        decoded.write(Stomp.ESCAPE);
                        break;
                    default:
                        stream.unread(next);
                        decoded.write(value);
                    }
                } else {
                    decoded.write(value);
                }
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 InflaterInputStream(pushback);
        } catch (DataFormatException e) {

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

            return new InflaterInputStream(pushback);
        } catch (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 InflaterInputStream(pushback, new Inflater(true));
        }
    }

    /**
 
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

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.