Package java.io

Examples of java.io.PushbackInputStream


            socket.setTcpNoDelay(soNodelay);
            socket.setSoTimeout(soTimeout);
            if (sendBufferSize != -1) {
                socket.setSendBufferSize(sendBufferSize);
            }
            inputStream = new PushbackInputStream(socket.getInputStream());
            outputStream = new BufferedOutputStream(
                new WrappedOutputStream(socket.getOutputStream()),
                socket.getSendBufferSize()
            );
            isOpen = true;
View Full Code Here


            }
            int outbuffersize = socket.getSendBufferSize();
            if (outbuffersize > 2048) {
                outbuffersize = 2048;
            }
            inputStream = new PushbackInputStream(socket.getInputStream());
            outputStream = new BufferedOutputStream(
                new WrappedOutputStream(socket.getOutputStream()),
                outbuffersize
            );
            isOpen = true;
View Full Code Here

        }       
        int outbuffersize = socket.getSendBufferSize();
        if (outbuffersize > 2048) {
            outbuffersize = 2048;
        }
        inputStream = new PushbackInputStream(socket.getInputStream());
        outputStream = new BufferedOutputStream(
            new WrappedOutputStream(socket.getOutputStream()),
            outbuffersize
        );
        usingSecureSocket = true;
View Full Code Here

        if(b == null)
            return null;
        DataBag db;
        try {
            ByteArrayInputStream bis = new ByteArrayInputStream(b);
            PushbackInputStream in = new PushbackInputStream(bis);
            db = consumeBag(in, schema);
        } catch (IOException e) {
            LogUtils.warn(this, "Unable to interpret value " + Arrays.toString(b) + " in field being " +
                    "converted to type bag, caught ParseException <" +
                    e.getMessage() + "> field discarded",
View Full Code Here

        Map<String, Object> map;
        ResourceFieldSchema fs = new ResourceFieldSchema();
        fs.setType(DataType.MAP);
        try {
            ByteArrayInputStream bis = new ByteArrayInputStream(b);
            PushbackInputStream in = new PushbackInputStream(bis);
            map = consumeMap(in, fs);
        }
        catch (IOException e) {
            LogUtils.warn(this, "Unable to interpret value " + Arrays.toString(b) + " in field being " +
                    "converted to type map, caught ParseException <" +
View Full Code Here

            return null;
        Tuple t;
       
        try {
            ByteArrayInputStream bis = new ByteArrayInputStream(b);
            PushbackInputStream in = new PushbackInputStream(bis);
            t = consumeTuple(in, fieldSchema);
        }
        catch (IOException e) {
            LogUtils.warn(this, "Unable to interpret value " + Arrays.toString(b) + " in field being " +
                    "converted to type tuple, caught ParseException <" +
View Full Code Here

                    // push back the characters we read
                    if (DEBUG_ENCODINGS) {
                        System.out.println("$$$ wrapping input stream in PushbackInputStream");
                    }
                    PushbackInputStream pbstream = new PushbackInputStream(stream, 4);
                    pbstream.unread(b4, 0, count);

                    // REVISIT: Should save the original input stream instead of
                    //          the pushback input stream so that when we swap out
                    //          the OneCharReader, we don't still have a method
                    //          indirection to get at the underlying bytes. -Ac
View Full Code Here

     * @param is The input stream to read.
     * @param encod The character encoding to use if the auto-detection fail.
     */
    public XMLStreamNormalizingReader(InputStream is, String encod)
        throws IOException {
        PushbackInputStream pbis = new PushbackInputStream(is, 128);
        byte[] buf = new byte[4];

        int len = pbis.read(buf);
        if (len > 0) {
            pbis.unread(buf, 0, len);
        }

        if (len == 4) {
            switch (buf[0] & 0x00FF) {
            case 0:
View Full Code Here

    public ConfigurationData readConfigurationData(InputStream in) throws IOException, ClassNotFoundException {
        if (!(in instanceof BufferedInputStream)) {
            in = new BufferedInputStream(in);
        }
        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

public class ExtractorFactory {
  public static final String CORE_DOCUMENT_REL =
    "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument";
 
  public static POITextExtractor createExtractor(File f) throws IOException, InvalidFormatException, OpenXML4JException, XmlException {
    InputStream inp = new PushbackInputStream(
      new FileInputStream(f), 8);
   
    if(POIFSFileSystem.hasPOIFSHeader(inp)) {
      return createExtractor(new POIFSFileSystem(inp));
    }
    if(POIXMLDocument.hasOOXMLHeader(inp)) {
      inp.close();
      return createExtractor(OPCPackage.open(f.toString()));
    }
    throw new IllegalArgumentException("Your File was neither an OLE2 file, nor an OOXML file");
  }
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.