/** * Constructs an instance of the class for a given filename * Note that on a FileNotFoundException, this contructor will sleep for 2 seconds * before retrying to open the file. * @param filename String with the name of the underlying file * @throws java.io.IOException if an I/O error occurs */ public BitOutputStream(String filename) throws IOException { try{ dos = new DataOutputStream(Files.writeFileStream(filename)); } catch(FileNotFoundException fnfe) { final String dir = Files.getParent(filename); logger.warn("Could not open new BitOutputStream because it alleged file could not be found.", fnfe); if (logger.isDebugEnabled()) logger.debug("File.canRead()="+Files.canWrite(filename)+ "Dir.exists()=" +Files.exists(dir) + " Dir.canWrite()="+Files.canWrite(dir) +" Dir.contentsSize="+Files.list(dir).length); sleep(1000); if (logger.isDebugEnabled()) logger.debug("File.canRead()="+Files.canWrite(filename)+ "Dir.exists()=" +Files.exists(dir) + " Dir.canWrite()="+Files.canWrite(dir)+" Dir.contentsSize="+Files.list(dir).length); logger.warn("Retrying to write BitOutputStream."); dos = new DataOutputStream(Files.writeFileStream(filename)); logger.info("Previous warning can be ignored, BitOutputStream "+filename+" has opened successfully"); } init(); }
public ByteOutputStream(String filename) throws IOException { OutputStream file; try{ file = Files.writeFileStream(filename); init(file); } catch(FileNotFoundException fnfe) { final String dir = Files.getParent(filename); logger.warn("Could not open new ByteOutputStream because it alleged file could not be found.", fnfe); if (logger.isDebugEnabled()) logger.debug("File.canRead()="+Files.canWrite(filename)+ "Dir.exists()=" +Files.exists(dir) + " Dir.canWrite()="+Files.canWrite(dir) +" Dir.contentsSize="+Files.list(dir).length); sleep(1000); if (logger.isDebugEnabled()) logger.debug("File.canRead()="+Files.canWrite(filename)+ "Dir.exists()=" +Files.exists(dir) + " Dir.canWrite()="+Files.canWrite(dir)+" Dir.contentsSize="+Files.list(dir).length); logger.warn("Retrying to write BitOutputStream."); init(Files.writeFileStream(filename)); logger.info("Previous warning can be ignored, BitOutputStream "+filename+" has opened successfully"); } }
/** * Constructs an instance of the class for a given filename * Note that on a FileNotFoundException, this contructor will sleep for 2 seconds * before retrying to open the file. * @param filename String with the name of the underlying file * @throws java.io.IOException if an I/O error occurs */ public BitOutputStream(String filename) throws IOException { try{ dos = new DataOutputStream(Files.writeFileStream(filename)); } catch(FileNotFoundException fnfe) { final String dir = Files.getParent(filename); logger.warn("Could not open new BitOutputStream because it alleged file could not be found.", fnfe); if (logger.isDebugEnabled()) logger.debug("File.canRead()="+Files.canWrite(filename)+ "Dir.exists()=" +Files.exists(dir) + " Dir.canWrite()="+Files.canWrite(dir) +" Dir.contentsSize="+Files.list(dir).length); sleep(1000); if (logger.isDebugEnabled()) logger.debug("File.canRead()="+Files.canWrite(filename)+ "Dir.exists()=" +Files.exists(dir) + " Dir.canWrite()="+Files.canWrite(dir)+" Dir.contentsSize="+Files.list(dir).length); logger.warn("Retrying to write BitOutputStream."); dos = new DataOutputStream(Files.writeFileStream(filename)); logger.info("Previous warning can be ignored, BitOutputStream "+filename+" has opened successfully"); } init(); }
public ByteOutputStream(String filename) throws IOException { OutputStream file; try{ file = Files.writeFileStream(filename); init(file); } catch(FileNotFoundException fnfe) { final String dir = Files.getParent(filename); logger.warn("Could not open new ByteOutputStream because it alleged file could not be found.", fnfe); if (logger.isDebugEnabled()) logger.debug("File.canRead()="+Files.canWrite(filename)+ "Dir.exists()=" +Files.exists(dir) + " Dir.canWrite()="+Files.canWrite(dir) +" Dir.contentsSize="+Files.list(dir).length); sleep(1000); if (logger.isDebugEnabled()) logger.debug("File.canRead()="+Files.canWrite(filename)+ "Dir.exists()=" +Files.exists(dir) + " Dir.canWrite()="+Files.canWrite(dir)+" Dir.contentsSize="+Files.list(dir).length); logger.warn("Retrying to write BitOutputStream."); init(Files.writeFileStream(filename)); logger.info("Previous warning can be ignored, BitOutputStream "+filename+" has opened successfully"); } }