Package java.io

Examples of java.io.InputStream.reset()


        while(size>0)
        {
          stream.mark(markSize);
          bytesRead=stream.read(buffer);
          ostream.write(buffer);
          stream.reset();                 
          size = size-bytesRead;         
        }         
      } catch (IOException e) {       
        e.printStackTrace();
     
View Full Code Here


                    if (DEBUG_ENCODINGS) {
                        System.out.println("$$$ wrapping input stream in PushbackInputStream");
                    }
                    PushbackInputStream pbstream = new PushbackInputStream(stream, 4);
                    *****/
                    stream.reset();
                    int offset = 0;
                    // Special case UTF-8 files with BOM created by Microsoft
                    // tools. It's more efficient to consume the BOM than make
                    // the reader perform extra checks. -Ac
                    if (count > 2 && encoding.equals("UTF-8")) {
View Full Code Here

        }
        InputStream is = getResetableInputStream();
        if (is != null) {
            // resetable can read again bytes.
      if (bytes == null) {
                is.reset();      
                bytes=JavaUtils.getBytesFromStream(is);
           }      
           return bytes;              
        }
        Canonicalizer20010315OmitComments c14nizer =
View Full Code Here

                InputStream is = getResetableInputStream();
                if (bytes != null) {
                    // already read write it, can be rea.
                  diOs.write(bytes, 0, bytes.length);
                } else {
                    is.reset();           
                    byte[] bytesT = new byte[1024];
                    int num = 0;
                    while ((num = is.read(bytesT)) > 0) {
                      diOs.write(bytesT, 0, num);
                    }
View Full Code Here

                }
                if (count == 4) {
                    EncodingInfo info = getEncodingInfo(b4, count);
                    encoding = info.encoding;
                    isBigEndian = info.isBigEndian;
                    stream.reset();
                    if (info.hasBOM) {
                        // Special case UTF-8 files with BOM created by Microsoft
                        // tools. It's more efficient to consume the BOM than make
                        // the reader perform extra checks. -Ac
                        if (encoding == "UTF-8") {
View Full Code Here

                            break;
                    }
                    if (count == 3) {
                        if (b3[0] != 0xEF || b3[1] != 0xBB || b3[2] != 0xBF) {
                            // First three bytes are not BOM, so reset.
                            stream.reset();
                        }
                    }
                    else {
                        stream.reset();
                    }
View Full Code Here

                            // First three bytes are not BOM, so reset.
                            stream.reset();
                        }
                    }
                    else {
                        stream.reset();
                    }
                    reader = createReader(stream, "UTF-8", isBigEndian);
                }
                // If encoding is UTF-16, we still need to read the first
                // four bytes, in order to discover the byte order.
View Full Code Here

                    for (; count < 4; ++count) {
                        b4[count] = rewindableStream.readAndBuffer();
                        if (b4[count] == -1)
                            break;
                    }
                    stream.reset();
                    if (count >= 2) {
                        final int b0 = b4[0];
                        final int b1 = b4[1];
                        if (b0 == 0xFE && b1 == 0xFF) {
                            // UTF-16, big-endian
View Full Code Here

                    for (; count < 4; ++count) {
                        b4[count] = rewindableStream.readAndBuffer();
                        if (b4[count] == -1)
                            break;
                    }
                    stream.reset();

                    // Ignore unusual octet order for now.
                    if (count == 4) {
                        // UCS-4, big endian (1234)
                        if (b4[0] == 0x00 && b4[1] == 0x00 && b4[2] == 0x00 && b4[3] == 0x3C) {
View Full Code Here

                    for (; count < 4; ++count) {
                        b4[count] = rewindableStream.readAndBuffer();
                        if (b4[count] == -1)
                            break;
                    }
                    stream.reset();

                    if (count == 4) {
                        // UCS-2, big endian
                        if (b4[0] == 0x00 && b4[1] == 0x3C && b4[2] == 0x00 && b4[3] == 0x3F) {
                            isBigEndian = Boolean.TRUE;
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.