9091929394959697
{ return File.createTempFile(prefix, suffix, directory); } catch (IOException e) { throw new FSWriteError(e, directory); } }
115116117118119120121122
{ Files.delete(file.toPath()); } catch (IOException e) { throw new FSWriteError(e, file); } }
192193194195196197198199200201202
{ file.getChannel().truncate(size); } catch (IOException e) { throw new FSWriteError(e, path); } finally { closeQuietly(file); }
298299300301302303304305
public static void createDirectory(File directory) { if (!directory.exists()) { if (!directory.mkdirs()) throw new FSWriteError(new IOException("Failed to mkdirs " + directory), directory); } }
185186187188189190191192
{ out.getFD().sync(); } catch (IOException e) { throw new FSWriteError(e, getPath()); } }
269270271272273274275276277278279
{ out.write(buffer, 0, validBufferBytes); } catch (IOException e) { throw new FSWriteError(e, getPath()); } if (metadata != null) metadata.append(buffer, 0, validBufferBytes); }
373374375376377378379380
{ out.getChannel().truncate(toSize); } catch (IOException e) { throw new FSWriteError(e, getPath()); } }
396397398399400401402403404405406
{ out.close(); } catch (IOException e) { throw new FSWriteError(e, getPath()); } FileUtils.closeQuietly(metadata); CLibrary.tryCloseFD(directoryFD); }
141142143144145146147148149150151
// write corresponding checksum out.writeInt((int) checksum.getValue()); } catch (IOException e) { throw new FSWriteError(e, getPath()); } // reset checksum object to the blank state for re-use checksum.reset();
264265266267268269270271
{ metadataWriter.close(); } catch (IOException e) { throw new FSWriteError(e, getPath()); } }