Package java.io

Examples of java.io.PushbackInputStream.unread()


    public static SQLXML jsonToXml(CommandContext context, final String rootName, final Blob json) throws TeiidComponentException, TeiidProcessingException, SQLException, IOException {
    InputStream is = json.getBinaryStream();
    PushbackInputStream pStream = new PushbackInputStream(is, 4);
    byte[] encoding = new byte[3];
    int read = pStream.read(encoding);
    pStream.unread(encoding, 0, read);
    Charset charset = UTF_8;
    if (read > 2) {
      if (encoding[0] == 0) {
        if (encoding[1] == 0) {
          charset = UTF_32BE;
View Full Code Here


            if ((bb & 0xFF) == lcbr) { //multi
                if (transferUntil(pis, keyStream, mClose)) { //close tag
                    //multi_key =  "_" + keyStream.toString(); //for _Key
                    bb = pis.read();
                    if ((bb & 0xFF) != 10){ //kill newline
                        pis.unread(bb);
                    }
                    multi_key = keyStream.toByteArray(); //IMPORTANT: no prefix here
                    keyStream.reset(); //reset stream

                    //this needs multi_key without prefix
View Full Code Here

                    //this needs multi_key without prefix
                    if (transferUntil(pis, keyStream, appendBytes(mOpen, slashChar, multi_key, mClose))){
                        bb = pis.read();
                        if((bb & 0xFF) != 10){ //kill newline
                            pis.unread(bb);
                        }

                        final byte[] text=keyStream.toByteArray(); //text between #{key}# an #{/key}#
                        int num=0;
                        final String patternKey = getPatternKey(prefix, multi_key);
View Full Code Here

                    //          ")");
                    out.write( node.getCode() );
                    buffer.reset();
                }

                input.unread( nextByte );
            }
            else
            {
                //log.debug("encode - EOF on lookahead: writing node, resetting buffer, and terminating read loop (" +
                //          " node.getCode: " + node.getCode() + ")" +
View Full Code Here

                //log.debug("encode - Clearing dictionary and unreading pending buffer data (" +
                //          " bitsInChunk: " + out.getBitsInChunk() +
                //          ")");
                out.write( CLEAR_TABLE );
                dic = new LZWDictionary();
                input.unread( buffer.toByteArray() );
                buffer.reset();
            }
        }

        // Fix the code size based on the fact that we are writing the EOD
View Full Code Here

      byte[] header = new byte[3];
      int len = pis.read(header, 0, 3);
      if (len < 1)
        return in;
      if (header[0] != UTF_BOM[0] || header[1] != UTF_BOM[1] || header[2] != UTF_BOM[2]) {
        pis.unread(header, 0, len);
      }
      return pis;
    }
    catch (IOException e) {
      throw Lang.wrapThrow(e);
View Full Code Here

                messageContext.setProperty(BaseConstants.FAULT_MESSAGE, SynapseConstants.TRUE);
                if (log.isDebugEnabled()) {
                    log.debug("Hessian fault detected, marking in Axis2 message context");
                }
            }
            pis.unread(headerBytes);
        } else if (n > 0) {
                byte[] bytesRead = new byte[n];
                System.arraycopy(headerBytes, 0, bytesRead, 0, n);
                pis.unread(bytesRead);
        }
View Full Code Here

            }
            pis.unread(headerBytes);
        } else if (n > 0) {
                byte[] bytesRead = new byte[n];
                System.arraycopy(headerBytes, 0, bytesRead, 0, n);
                pis.unread(bytesRead);
        }
        return pis;
    }
}
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

                        @SuppressWarnings("resource")
                        PushbackInputStream pin =
                            new PushbackInputStream(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.