protected Writer initialize(final File f) throws FileNotFoundException, IOException { FileUtils.moveAsideIfExists(f); return new OutputStreamWriter(new GZIPOutputStream( new FastBufferedOutputStream(new FileOutputStream(f),32*1024))); }
try (FastBufferedOutputStream outputStream = new FastBufferedOutputStream(new FileOutputStream(outputFilename))) { ProgressLogger pg = new ProgressLogger(LOG); pg.expectedUpdates = inputs.numExamples() / args().miniBatchSize; outputStream.write((bytes.length >> 8 * 3) & 0xFF); outputStream.write((bytes.length >> 8 * 2) & 0xFF); outputStream.write((bytes.length >> 8) & 0xFF); outputStream.write(bytes.length & 0xFF); outputStream.write(bytes); pg.lightUpdate(); if (numRecordsWritten > writeAtMostN) { outputStream.close(); pg.stop();
@Override public void write(final int b) throws IOException { if (ASSERTS) assert avail > 0; avail--; buffer[pos++] = (byte)b; dumpBuffer(true); }
try (FastBufferedOutputStream outputStream = new FastBufferedOutputStream(new FileOutputStream(outputFilename))) { ProgressLogger pg = new ProgressLogger(LOG); long numExamples = domainDescriptor.getNumRecords(args().getTrainingSets()); outputStream.write((bytes.length >> 8 * 3) & 0xFF); outputStream.write((bytes.length >> 8 * 2) & 0xFF); outputStream.write((bytes.length >> 8) & 0xFF); outputStream.write(bytes.length & 0xFF); outputStream.write(bytes); pg.lightUpdate(); if (numRecordsWritten > writeAtMostN) { outputStream.close(); pg.stop();
@Override public void flush() throws IOException { dumpBuffer(false); os.flush(); }
return new FastBufferedOutputStream(new FileOutputStream(arcFile));
FastBufferedOutputStream uriStream = null, titleStream = null; if ( jsapResult.userSpecified( "uris" ) ) uriStream = new FastBufferedOutputStream( new FileOutputStream( jsapResult.getString( "uris" ) ) ); if ( jsapResult.userSpecified( "titles" ) ) titleStream = new FastBufferedOutputStream( new FileOutputStream( jsapResult.getString( "titles" ) ) ); s.replace( LINE_TERMINATORS, SPACES ); s.writeUTF8( uriStream ); uriStream.write( '\n' ); s.replace( LINE_TERMINATORS, SPACES ); s.writeUTF8( titleStream ); titleStream.write( '\n' ); if ( uriStream != null ) uriStream.close(); if ( titleStream != null ) titleStream.close();
@Override public void write(final byte b[], final int offset, final int length) throws IOException { if (length >= buffer.length) { dumpBuffer(false); os.write(b, offset, length); return; } if (length <= avail) { // Copy in buffer System.arraycopy(b, offset, buffer, pos, length); pos += length; avail -= length; dumpBuffer(true); return; } dumpBuffer(false); System.arraycopy(b, offset, buffer, 0, length); pos = length; avail -= length; }
protected OutputStream ensureDiskStream() throws FileNotFoundException { if (this.diskStream == null) { FileOutputStream fis = new FileOutputStream(this.backingFilename); this.diskStream = new FastBufferedOutputStream(fis); } return this.diskStream; }
FastBufferedOutputStream uriStream = null, titleStream = null; if ( jsapResult.userSpecified( "uris" ) ) uriStream = new FastBufferedOutputStream( new FileOutputStream( jsapResult.getString( "uris" ) ) ); if ( jsapResult.userSpecified( "titles" ) ) titleStream = new FastBufferedOutputStream( new FileOutputStream( jsapResult.getString( "titles" ) ) ); s.writeUTF8( uriStream ); uriStream.write( '\n' ); s.writeUTF8( titleStream ); titleStream.write( '\n' ); if ( uriStream != null ) uriStream.close(); if ( titleStream != null ) titleStream.close();
protected OutputStream ensureDiskStream() throws FileNotFoundException { if (this.diskStream == null) { FileOutputStream fis = new FileOutputStream(this.backingFilename); this.diskStream = new FastBufferedOutputStream(fis); } return this.diskStream; }
temp.deleteOnExit(); termFile = temp.toString(); final FastBufferedOutputStream outputStream = new FastBufferedOutputStream( new FileOutputStream( termFile ), bufferSize ); MutableString uri; while( termIterator.hasNext() ) { makeUnique( filter, uri ); uri.writeUTF8( outputStream ); outputStream.write( '\n' ); outputStream.close();
/** Stores an array to a file given by a {@link File} object. * * @param array an array whose elements will be written to {@code filename}. * @param file a file. */ public static void storeChars(final char array[], final File file) throws IOException { final int length = array.length; final DataOutputStream dos = new DataOutputStream(new FastBufferedOutputStream(new FileOutputStream(file))); for(int i = 0; i < length; i++) dos.writeChar(array[i]); dos.close(); } /** Stores an array to a file given by a pathname.
temp.deleteOnExit(); termFile = temp.toString(); final FastBufferedOutputStream outputStream = new FastBufferedOutputStream( new FileOutputStream( termFile ), bufferSize ); MutableString uri; while( termIterator.hasNext() ) { makeUnique( filter, uri ); uri.writeUTF8( outputStream ); outputStream.write( '\n' ); outputStream.close();
/** Stores an array to a file given by a {@link File} object. * * @param array an array whose elements will be written to {@code filename}. * @param file a file. */ public static void storeLongs(final long array[], final File file) throws IOException { final int length = array.length; final DataOutputStream dos = new DataOutputStream(new FastBufferedOutputStream(new FileOutputStream(file))); for(int i = 0; i < length; i++) dos.writeLong(array[i]); dos.close(); } /** Stores an array to a file given by a pathname.
temp.deleteOnExit(); termFile = temp.toString(); final FastBufferedOutputStream outputStream = new FastBufferedOutputStream( new FileOutputStream( termFile ), bufferSize ); MutableString uri; while( termIterator.hasNext() ) { makeUnique( filter, uri ); uri.writeUTF8( outputStream ); outputStream.write( '\n' ); outputStream.close();
/** Stores an array to a file given by a {@link File} object. * * @param array an array whose elements will be written to {@code filename}. * @param file a file. */ public static void storeDoubles(final double array[], final File file) throws IOException { final int length = array.length; final DataOutputStream dos = new DataOutputStream(new FastBufferedOutputStream(new FileOutputStream(file))); for(int i = 0; i < length; i++) dos.writeDouble(array[i]); dos.close(); } /** Stores an array to a file given by a pathname.
temp.deleteOnExit(); termFile = temp.toString(); final FastBufferedOutputStream outputStream = new FastBufferedOutputStream( new FileOutputStream( termFile ), bufferSize ); MutableString uri; while( termIterator.hasNext() ) { makeUnique( filter, uri ); uri.writeUTF8( outputStream ); outputStream.write( '\n' ); outputStream.close();
/** Stores an array to a file given by a {@link File} object. * * @param array an array whose elements will be written to {@code filename}. * @param file a file. */ public static void storeBooleans(final boolean array[], final File file) throws IOException { final int length = array.length; final DataOutputStream dos = new DataOutputStream(new FastBufferedOutputStream(new FileOutputStream(file))); for(int i = 0; i < length; i++) dos.writeBoolean(array[i]); dos.close(); } /** Stores an array to a file given by a pathname.
PrintStream titleStream = null; if ( jsapResult.userSpecified( "uris" ) ) uriStream = new FastBufferedOutputStream( new FileOutputStream( jsapResult.getString( "uris" ) ) ); if ( jsapResult.userSpecified( "titles" ) ) titleStream = new PrintStream( jsapResult.getString( "titles" ), "UTF-8" ); s.writeUTF8( uriStream ); uriStream.write( '\n' ); if ( uriStream != null ) uriStream.close(); if ( titleStream != null ) titleStream.close();