Package java.io

Examples of java.io.BufferedInputStream


    {
      InputStream in = null;
      try
      {
        final FileInputStream fileIn = new FileInputStream(fileChooser.getSelectedFile());
        in = new BufferedInputStream(fileIn);
        model.load(in);
        model.sort();
        setStatusText(resources.getString("config-description-editor.load-complete")); //$NON-NLS-1$
      }
      catch (Exception ioe)
View Full Code Here


    private void initRead() throws IOException {
        if (input == null) {
            try {
                InputStream in = IOUtils.openFileInputStream(fileName);
                in = new BufferedInputStream(in, Constants.IO_BUFFER_SIZE);
                input = new InputStreamReader(in, characterSet);
            } catch (IOException e) {
                close();
                throw e;
            }
View Full Code Here

    private void process(Connection conn, String fileName,
            boolean continueOnError, String charsetName) throws SQLException, IOException {
        InputStream in = IOUtils.openFileInputStream(fileName);
        String path = IOUtils.getParent(fileName);
        try {
            in = new BufferedInputStream(in, Constants.IO_BUFFER_SIZE);
            Reader reader = new InputStreamReader(in, charsetName);
            process(conn, continueOnError, path, reader, charsetName);
        } finally {
            IOUtils.closeSilently(in);
        }
View Full Code Here

                }

                URL zipurl = PropUtils.getResourceOrFileOrURL(zipFileName);
                if (zipurl != null) {

                    in = new BufferedInputStream(zipurl.openStream());

                    if (Debug.debugging("zip")) {
                        Debug.output(" unzipping " + zipFileName);
                    }
                    ZipInputStream zin = new ZipInputStream(in);
View Full Code Here

        // wil check that this file exists, and that is about it.
        //System.out.println("Created JarLoader for file: " +
        // jarName);
        this.jarName = jarName;
        InputStream is = new FileInputStream(jarName);
        jarStream = new BufferedInputStream(is);
    }
View Full Code Here

        OutputStream output;
        Exception exception;
        InputStream input = null;
        output = null;
        try {
            input = new BufferedInputStream(srcStream);
            output = new BufferedOutputStream(new FileOutputStream(destFile));
            int ch;
            while ((ch = input.read()) != -1)
                output.write(ch);
        } catch (IOException e) {
View Full Code Here

  public <T extends InputCapture<? extends FilePacket>> T newInput(
      final Class<T> t, final File file, Filter<ProtocolFilterTarget> filter)
      throws IOException {

    final BufferedInputStream b =
        new BufferedInputStream(new FileInputStream(file));
    b.mark(1024); // Buffer first 1K of stream so we can rewind

    /*
     * Check the stream, without decompression first
     */
    if (formatType(Channels.newChannel(b)) != null) {
      b.close();

      /*
       * This is a plain uncompressed file, open up a FileChannel. It will be
       * much faster
       */
      return newInput(t, new RandomAccessFile(file, "rw").getChannel(), filter);
    }

    /*
     * Try with gunziped stream, second
     */
    b.reset(); // Rewind
    if (formatType(Channels.newChannel(new GZIPInputStream(b))) != null) {
      b.close();

      /*
       * Now reopen the same file, but this time without the buffered
       * inputstream in the middle. Try to make things as efficient as possible.
       * TODO: implement much faster channel based GZIP decompression algorithm
View Full Code Here

  }

  public InputCapture<? extends CapturePacket> newInput(final File file,
      final Filter<ProtocolFilterTarget> filter) throws IOException {

    final BufferedInputStream b =
        new BufferedInputStream(new FileInputStream(file));
    b.mark(1024); // Buffer first 1K of stream so we can rewind

    /*
     * Check the stream, without decompression first
     */
    if (formatType(Channels.newChannel(b)) != null) {
      b.close();

      /*
       * This is a plain uncompressed file, open up a FileChannel. It will be
       * much faster
       */
      return newInput(new RandomAccessFile(file, "rw").getChannel(), filter);
    }

    /*
     * Try with gunziped stream, second
     */
    b.reset(); // Rewind
    if (formatType(Channels.newChannel(new GZIPInputStream(b))) != null) {
      b.close();

      /*
       * Now reopen the same file, but this time without the buffered
       * inputstream in the middle. Try to make things as efficient as possible.
       * TODO: implement much faster channel based GZIP decompression algorithm
       */
      return newInput(Channels.newChannel(new GZIPInputStream(
          new FileInputStream(file))), filter);
    }

    b.close();
    return factoryForOther.getFactory().newInput(
        new RandomAccessFile(file, "r").getChannel(), filter);

  }
View Full Code Here

        if (small != null) {
            return new ByteArrayInputStream(small);
        } else if (fileName != null) {
            FileStore store = handler.openFile(fileName, "r", true);
            boolean alwaysClose = SysProperties.lobCloseBetweenReads;
            return new BufferedInputStream(new FileStoreInputStream(store, handler, false, alwaysClose),
                    Constants.IO_BUFFER_SIZE);
        }
        long byteCount = (type == Value.BLOB) ? precision : -1;
        try {
            return lobStorage.getInputStream(lobId, byteCount);
View Full Code Here

                sData.getCertificates().getObjectAt(sDataObjectCount++)));
      }
     
        if (!in.markSupported())
        {
            in = new BufferedInputStream(in);
        }

        try
        {
            in.mark(10);
View Full Code Here

TOP

Related Classes of java.io.BufferedInputStream

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.