Package java.io

Examples of java.io.FileOutputStream


        BlobType bv = new BlobType(blob);
        String key = bv.getReferenceStreamId();
       
        // now force to serialize
        File saved = new File(UnitTestUtil.getTestScratchPath()+"/blobassaved.bin"); //$NON-NLS-1$
        ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(saved));
        out.writeObject(bv);
        out.close();
       
        // now read back the object from serilized state
        ObjectInputStream in = new ObjectInputStream(new FileInputStream(saved));
View Full Code Here


        write(fw, reader, -1);  
    }

    public static void write(final InputStream is, final File f) throws IOException {
      f.getParentFile().mkdirs();
        FileOutputStream fio = new FileOutputStream(f);
        BufferedOutputStream bos = new BufferedOutputStream(fio);
      write(bos, is, -1);
    }
View Full Code Here

       
        if(filename.length() == 0){
            ArgCheck.isNotZeroLength(filename,CorePlugin.Util.getString("JdomHelper.The_filename_may_not_be_zero-length_44")); //$NON-NLS-1$
        }
       
        FileOutputStream out = new FileOutputStream( filename );
        try {
          write(doc,out,indent,newlines);
          out.flush();
        } finally {
          out.close();
        }
    }
View Full Code Here

      File file = new File(fileName);
      System.out.println("FILE PATH: " + file.getAbsolutePath());
      //FileOutputStream is meant for writing streams of raw bytes of data such as image data.
      //For writing streams of characters, consider using FileWriter.
      FileOutputStream output = new FileOutputStream(file);

      //The initial whole HTMLDocument
      HTMLDocument document = HTMLParser.createDocument(this.data.toByteArray(), this.charset_);

      //The new HTMLDocument after spliting (separating) only childPath<NodePath>-->only a Node.
      document = NodePathUtil.create(document.getRoot(), new NodePath[]{this.childPath_});

      output.write(document.getTextValue().getBytes("utf-8"));
      output.flush();

      output.close();
      this.data = null;
   }
View Full Code Here

        deleteDb("script");
        String outFile = "test.out.txt";
        String inFile = fileName;
        conn = getConnection("script");
        stat = conn.createStatement();
        out = new PrintStream(new FileOutputStream(outFile));
        errors = new StringBuilder();
        testFile(inFile);
        conn.close();
        out.close();
        if (errors.length() > 0) {
View Full Code Here

    final File parentDir = f.getParentFile();
    if (parentDir !=null) {
      parentDir.mkdirs();
    }

    FileOutputStream fio = null;
    BufferedOutputStream bos = null;
        try {
            fio = new FileOutputStream(f);
            bos = new BufferedOutputStream(fio);
            if (bufferSize > 0) {
            byte[] buff = new byte[bufferSize];
            int bytesRead;
       
            // Simple read/write loop.
            while(-1 != (bytesRead = is.read(buff, 0, buff.length))) {
              bos.write(buff, 0, bytesRead);
            }
            }
            bos.flush();
        } finally {
            if (bos != null) {
                bos.close();
            }
            if (fio != null) {
                fio.close();
            }
        }
   }
View Full Code Here

    }
   

    public static File convertByteArrayToFile(final byte[] contents, final String parentDirectoryPath, final String fileName) {
        if (contents != null) {
            FileOutputStream os = null;
            try {
                final File temp = new File(parentDirectoryPath,fileName);
                os = new FileOutputStream(temp);
                os.write(contents);
                return temp;
            } catch (Exception e) {
                throw new TeiidRuntimeException(e);
            } finally {
                if (os != null) {
                    try {
                        os.close();
                    } catch (IOException e1) {
                       // do nothing
                    }
                }
            }
View Full Code Here

  private void saveList() {
    Map map = new HashMap();
    map.put("trackers",trackers);
    map.put("multi-trackers",multiTrackers);
    map.put("webseeds",webseeds );
    FileOutputStream fos = null;
    try {
      //  Open the file
      File fTrackers = FileUtil.getUserFile("trackers.config");
      fos = new FileOutputStream(fTrackers);
      fos.write(BEncoder.encode(map));
      fos.close();    
    } catch (Exception e) {
      Debug.printStackTrace( e );
    } finally{
    if ( fos != null ){
      try{
        fos.close();
      }catch( Throwable e ){
      }
    }    
    }
  }
View Full Code Here

        raf.setLength(offset);
        raf.seek(offset);

        // The IBM jre needs to have both the stream and the random access file
        // objects closed to actually close the file
        return new FileOutputStream(raf.getFD()) {
            @Override
            public void close() throws IOException {
                super.close();
                raf.close();
            }
View Full Code Here

      } catch (Exception e) {
        ci.out.println("> Exception while trying to output xml stats:" + e.getMessage());
      }
    } else {
      try {
        FileOutputStream os = new FileOutputStream(file);

        try {

          sws.write(os);

        } finally {

          os.close();
        }
        ci.out.println("> XML stats successfully written to " + file);
      } catch (Exception e) {
        ci.out.println("> Exception while trying to write xml stats:" + e.getMessage());
      }
View Full Code Here

TOP

Related Classes of java.io.FileOutputStream

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.