ucar.unidata.io.RandomAccessFile.setMinLength()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(3.0k)|赞(0)|评价(0)|浏览(123)

本文整理了Java中ucar.unidata.io.RandomAccessFile.setMinLength方法的一些代码示例,展示了RandomAccessFile.setMinLength的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RandomAccessFile.setMinLength方法的具体详情如下:
包路径:ucar.unidata.io.RandomAccessFile
类名称:RandomAccessFile
方法名:setMinLength

RandomAccessFile.setMinLength介绍

[英]Make sure file is at least this long when its closed. needed when not using fill mode, and not all data is written.
[中]确保文件关闭时至少有这么长。不使用填充模式时需要,并且并非所有数据都被写入。

代码示例

代码示例来源:origin: edu.ucar/cdm

  1. @Override
  2. public void close() throws java.io.IOException {
  3. if (raf != null) {
  4. long size = header.calcFileSize();
  5. raf.setMinLength( size);
  6. raf.close();
  7. }
  8. raf = null;
  9. }

代码示例来源:origin: Unidata/thredds

  1. @Override
  2. public void close() throws java.io.IOException {
  3. if (raf != null) {
  4. long size = header.calcFileSize();
  5. raf.setMinLength(size);
  6. raf.close();
  7. }
  8. raf = null;
  9. }

代码示例来源:origin: edu.ucar/netcdf

  1. public void close() throws java.io.IOException {
  2. if (raf != null) {
  3. long size = header.calcFileSize();
  4. raf.setMinLength( size);
  5. raf.close();
  6. }
  7. raf = null;
  8. }

代码示例来源:origin: Unidata/thredds

  1. protected void setNumrecs(int n) throws IOException, InvalidRangeException {
  2. if (n <= header.numrecs) return;
  3. int startRec = header.numrecs;
  4. if (debugSize) System.out.println("extend records to = " + n);
  5. //fileUsed = recStart + recsize * n;
  6. header.setNumrecs(n);
  7. //this.numrecs = n;
  8. // need to let unlimited dimension know of new shape
  9. for (Dimension dim : ncfile.getDimensions()) {
  10. if (dim.isUnlimited())
  11. dim.setLength(n);
  12. }
  13. // need to let all unlimited variables know of new shape
  14. for (Variable v : ncfile.getVariables()) {
  15. if (v.isUnlimited()) {
  16. v.resetShape();
  17. v.setCachedData(null, false);
  18. }
  19. }
  20. // extend file, handle filling
  21. if (fill)
  22. fillRecordVariables(startRec, n);
  23. else
  24. raf.setMinLength( header.calcFileSize());
  25. }

代码示例来源:origin: edu.ucar/cdm

  1. protected void setNumrecs(int n) throws IOException, InvalidRangeException {
  2. if (n <= header.numrecs) return;
  3. int startRec = header.numrecs;
  4. if (debugSize) System.out.println("extend records to = " + n);
  5. //fileUsed = recStart + recsize * n;
  6. header.setNumrecs(n);
  7. //this.numrecs = n;
  8. // need to let unlimited dimension know of new shape
  9. for (Dimension dim : ncfile.getDimensions()) {
  10. if (dim.isUnlimited())
  11. dim.setLength(n);
  12. }
  13. // need to let all unlimited variables know of new shape
  14. for (Variable v : ncfile.getVariables()) {
  15. if (v.isUnlimited()) {
  16. v.resetShape();
  17. v.setCachedData(null, false);
  18. }
  19. }
  20. // extend file, handle filling
  21. if (fill)
  22. fillRecordVariables(startRec, n);
  23. else
  24. raf.setMinLength( header.calcFileSize());
  25. }

代码示例来源:origin: edu.ucar/netcdf

  1. protected void setNumrecs(int n) throws IOException, InvalidRangeException {
  2. if (n <= header.numrecs) return;
  3. int startRec = header.numrecs;
  4. if (debugSize) System.out.println("extend records to = " + n);
  5. //fileUsed = recStart + recsize * n;
  6. header.setNumrecs(n);
  7. //this.numrecs = n;
  8. // need to let unlimited dimension know of new shape
  9. for (Dimension dim : ncfile.getDimensions()) {
  10. if (dim.isUnlimited())
  11. dim.setLength(n);
  12. }
  13. // need to let all unlimited variables know of new shape
  14. for (Variable v : ncfile.getVariables()) {
  15. if (v.isUnlimited()) {
  16. v.resetShape();
  17. v.setCachedData(null, false);
  18. }
  19. }
  20. // extend file, handle filling
  21. if (fill)
  22. fillRecordVariables(startRec, n);
  23. else
  24. raf.setMinLength( header.calcFileSize());
  25. }

相关文章