BufferedOutputStream flush - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for BufferedOutputStream flush method.

This code example shows how to use the following methods:flush, close
        File file = resourceLoader.find( directory, filename );
        if ( file == null ) {
            file = resourceLoader.createFile(directory, filename);
        } 
         
        BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(file));
        try { 
            XStreamPersister xp = xpf.createXMLPersister();
            initXStreamPersister(xp, gs);
            xp.save( service, out );
             
            out.flush();
        } 
        finally { 
            out.close();
        } 
    } 
     
    /** 
     * Hook for subclasses to configure the xstream. 
8
CodeRank
This code example shows how to use the following methods:flush, close
                _file = new File (_tmpDir, fileName);
 
                BufferedOutputStream bos = null;
                try 
                { 
                    bos = new BufferedOutputStream(new FileOutputStream(_file));
                    _bout.writeTo(bos);
                    bos.flush();
                } 
                finally 
                { 
                    if (bos != null)
                        bos.close();
                    _bout = null;
                } 
            } 
            else 
            { 
                //the part data is already written to a temporary file, just rename it 
                _temporary = false;
7
CodeRank
This code example shows how to use the following methods:flush, close, write
This code example shows how to use the following methods:flush, close
         
//        File f = new File("src/test/resources/AVCClipCatTest/cat_key_clip.mp4"); 
 
//        Assert.assertArrayEquals(NIOUtils.toArray(NIOUtils.fetchFrom(f)), IOUtils.toByteArray(range)); 
 
        BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(new File(
                System.getProperty("user.home"), "Desktop/cat_key_clip.mp4")));
        IOUtils.copy(range, out);
        out.flush();
        out.close();
    } 
     
    @Test
    public void testAVCClip() throws IOException {
        File f1 = new File("src/test/resources/AVCClipCatTest/seq_1.mp4");
 
        MovieBox m1 = MP4Util.parseMovie(f1);
 
        VirtualTrack t1 = new AVCClipTrack(new RealTrack(m1, m1.getVideoTrack(), new FilePool(f1, 10)), 60, 120);
 
7
CodeRank
This code example shows how to use the following methods:flush
                contentId = contentIdArr[0];
            } 
            in = bp.getInputStream();
            File outFile = File.createTempFile(name, "attachment");
            FileOutputStream fout = new FileOutputStream(outFile);
            BufferedOutputStream bout = new BufferedOutputStream(fout);
            StreamUtils.readTo(in, bout);
            bout.flush();
            fout.flush();
            Utils.close(bout);
            Utils.close(fout);
            return new FileSystemAttachment(name, ct, outFile, contentId);
        } catch (IOException ex) {
            throw new RuntimeException(ex);
        } catch (MessagingException ex) {
            throw new RuntimeException(ex);
        } finally { 
            Utils.close(in);
        } 
    } 
7
CodeRank
This code example shows how to use the following methods:flush
        } 
    } 
 
    private void write(Object data) throws IOException, TransformerExceptionBufferedOutputStream bos = new BufferedOutputStream(socket.getOutputStream());
        this.getConnector().getTcpProtocol().write(bos, data);
        bos.flush();
    } 
 
    @Override 
    public RetryContext validateConnection(RetryContext retryContext)
    { 
        try 
        { 
            retryContext.setOk();
        } 
        catch (Exception ex)
        { 
            retryContext.setFailed(ex);
7
CodeRank
This code example shows how to use the following methods:flush, write
  } 
   
  public static void writeStringToFile(String content, String filePath) {
    BufferedOutputStream outputStream = null;
    try { 
      outputStream = new BufferedOutputStream(new FileOutputStream(getFile(filePath)));
      outputStream.write(content.getBytes());
      outputStream.flush();
    } catch(Exception e) {
      throw new ActivitiException("Couldn't write file " + filePath, e);
    } finally { 
      IoUtil.closeSilently(outputStream);
    } 
  } 
 
  /** 
   * Closes the given stream. The same as calling {@link InputStream#close()}, but 
   * errors while closing are silently ignored. 
   */ 
  public static void closeSilently(InputStream inputStream) {
7
CodeRank
This code example shows how to use the following methods:flush, write, close
public class OldAndroidBufferedOutputStreamTest extends TestCase {
 
    public void testBufferedOutputStream() throws Exception {
        String str = "AbCdEfGhIjKlMnOpQrStUvWxYz";
        ByteArrayOutputStream aa = new ByteArrayOutputStream();
        BufferedOutputStream a = new BufferedOutputStream(aa, 15);
        try { 
            a.write(str.getBytes(), 0, 26);
            a.write('A');
 
            assertEquals(26, aa.size());
            assertEquals(aa.toString(), str);
 
            a.flush();
 
            assertEquals(27, aa.size());
            assertEquals("AbCdEfGhIjKlMnOpQrStUvWxYzA", aa.toString());
        } finally { 
            a.close();
        } 

7
CodeRank
This code example shows how to use the following methods:flush, close
    public InputStream getInputStream() throws IOException {
        try { 
            File file = File.createTempFile("largeAttachment", ".tmp");
            file.deleteOnExit();
 
            BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(file));
            multipart.writeTo(out);
 
            out.flush();
            out.close();
 
            return new BufferedInputStream(new FileInputStream(file));
        } catch (Exception e) {
            SoapUI.logError(e);
            return null; 
        } 
    } 
 
    public String getName() {
        return multipart.toString();
7
CodeRank
This code example shows how to use the following methods:flush, close, write

Related BufferedOutputStream flush Questions & Answers:

flush Method Overview
Flushes this buffered output stream.
See Code Examples for other Java 8 BufferedOutputStream Methods: