Package java.io

Examples of java.io.PushbackInputStream


        private PushbackInputStream delegate;
       
        public ValueExpressionFilterInputStream(InputStream in)
        {
            super();
            delegate = new PushbackInputStream(in,255);
        }
View Full Code Here


         this.parts = new Hashtable();

         InputStream requestStream = request.getInputStream();
         BufferedInputStream bufferedStream = new BufferedInputStream(requestStream);
         PushbackInputStream pushbackStream = new PushbackInputStream(bufferedStream, MAX_BOUNDARY_SIZE);
         TokenStream stream = new TokenStream(pushbackStream);
                       
         parseMultiPart(stream,getBoundary(request.getContentType()));

         return this.parts;   
View Full Code Here

            (byte) ((ObjectStreamConstants.STREAM_MAGIC >>> 8) & 0xFF),
            (byte) ((ObjectStreamConstants.STREAM_MAGIC >>> 0) & 0xFF)
    };

    public ConfigurationData readConfigurationData(InputStream in) throws IOException, ClassNotFoundException {
        PushbackInputStream pushbackInputStream = new PushbackInputStream(in, 2);
        byte[] streamHeader = new byte[2];
        if (pushbackInputStream.read(streamHeader) != 2) throw new AssertionError("Cound not read stream header");
        pushbackInputStream.unread(streamHeader);

        // if this isn't a serialized config, fallback to the xstream marshaler
        if (SERIALIZED_MAGIC[0] != streamHeader[0] || SERIALIZED_MAGIC[1] != streamHeader[1]) {
            ConfigurationMarshaler marshaler;
            try {
View Full Code Here

      int ch = read();
      if (ch == '\r') {
    ch = read();
    if (ch != '\n') {
        if ((in instanceof PushbackInputStream) == false) {
      in = new PushbackInputStream(in);
        }
        ((PushbackInputStream) in).unread(ch);
    }
    break;
      } else if (ch == '\n') {
View Full Code Here

     * Since this is coming back with no headers, the content
     * length will be unknown and so the socket will be closed.
     */

// System.out.println("receiving HTTP/0.9 response");
    PushbackInputStream pin = new PushbackInputStream(hs.in,
      status.length() + 4);

    pin.unread('\n');
    pin.unread('\r');
    for (int i = status.length(); --i >= 0; ) {
        pin.unread(status.charAt(i));
    }

    /*
     * And push back a blank line, so the user thinks it got to
     * the end of the headers
     */
    pin.unread('\n');
    pin.unread('\r');

    status = "HTTP/1.0 200 OK";
    hs.in = pin;
    under = pin;
    in = new HttpInputStream(under);
View Full Code Here

  }

  protected InputStream doOpenForInput() throws IOException {
    // We want to automatically decompress if the underlying file is gzipped
    int pushBackBufferSize = 2;
    PushbackInputStream in = new PushbackInputStream(file.getContent().getInputStream(),
        pushBackBufferSize);
    int b1 = in.read();
    int b2 = in.read();
    in.unread(b2);
    in.unread(b1);
    if(b1 == GzFileConnection.GZIP_MAGIC_BYTE1 && b2 == GzFileConnection.GZIP_MAGIC_BYTE2) {
      return new GZIPInputStream(in);
    } else {
      return in;
    }
View Full Code Here

  private int line;
 
  private int column;
 
  public JSMin(InputStream in, OutputStream out) {
    this.in = new PushbackInputStream(in,2);
    this.out = out;
    this.line = 0;
    this.column = 0;
  }
View Full Code Here

                }
            }

            int limit = ProviderUtil.getReadLimit(in);

            PushbackInputStream pis = new PushbackInputStream(in);
            int tag = pis.read();

            if (tag == -1)
            {
                return null;
            }

            pis.unread(tag);

            if (tag != 0x30// assume ascii PEM encoded.
            {
                return readPEMCertificate(pis);
            }
View Full Code Here

                }
            }

            int limit = ProviderUtil.getReadLimit(inStream);

            PushbackInputStream pis = new PushbackInputStream(inStream);
            int tag = pis.read();

            if (tag == -1)
            {
                return null;
            }

            pis.unread(tag);

            if (tag != 0x30// assume ascii PEM encoded.
            {
                return readPEMCRL(pis);
            }
View Full Code Here

            if (null == boundaryString) {
                throw new IOException("Couldn't determine the boundary from the message!");
            }
            boundary = boundaryString.getBytes("utf-8");

            stream = new PushbackInputStream(message.getContent(InputStream.class),
                                             pbAmount);
            if (!readTillFirstBoundary(stream, boundary)) {
                throw new IOException("Couldn't find MIME boundary: " + boundaryString);
            }
View Full Code Here

TOP

Related Classes of java.io.PushbackInputStream

Copyright © 2018 www.massapicom. 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.