Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 9 of 9 for sizeIfKnown (0.08 sec)

  1. android/guava/src/com/google/common/io/ByteSource.java

       *
       * @throws IOException if an I/O error occurs
       * @since 15.0
       */
      public boolean isEmpty() throws IOException {
        Optional<Long> sizeIfKnown = sizeIfKnown();
        if (sizeIfKnown.isPresent()) {
          return sizeIfKnown.get() == 0L;
        }
        Closer closer = Closer.create();
        try {
          InputStream in = closer.register(openStream());
          return in.read() == -1;
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Sat Oct 19 00:26:48 UTC 2024
    - 26.2K bytes
    - Viewed (0)
  2. guava-tests/test/com/google/common/io/ByteSourceTester.java

        assertEquals(expected.length, source.size());
      }
    
      public void testSizeIfKnown() throws IOException {
        Optional<Long> sizeIfKnown = source.sizeIfKnown();
        if (sizeIfKnown.isPresent()) {
          assertEquals(expected.length, (long) sizeIfKnown.get());
        }
      }
    
      public void testContentEquals() throws IOException {
        assertTrue(
            source.contentEquals(
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Tue Jul 23 14:22:54 UTC 2024
    - 8.6K bytes
    - Viewed (0)
  3. android/guava-tests/benchmark/com/google/common/io/ByteSourceAsCharSourceReadBenchmark.java

        // come close.
        USING_DECODER_WITH_SIZE_HINT {
          @Override
          String read(ByteSource byteSource, Charset cs) throws IOException {
            Optional<Long> size = byteSource.sizeIfKnown();
            // if we know the size and it fits in an int
            if (size.isPresent() && size.get().longValue() == size.get().intValue()) {
              // otherwise try to presize a StringBuilder
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Mon Oct 10 19:45:10 UTC 2022
    - 5.2K bytes
    - Viewed (0)
  4. guava-tests/test/com/google/common/io/MoreFilesTest.java

          Path dir = fs.getPath("dir");
          Files.createDirectory(dir);
    
          ByteSource source = MoreFiles.asByteSource(dir);
    
          assertThat(source.sizeIfKnown()).isAbsent();
    
          assertThrows(IOException.class, () -> source.size());
        }
      }
    
      public void testByteSource_size_ofSymlinkToDirectory() throws IOException {
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Thu Oct 17 02:42:09 UTC 2024
    - 27.4K bytes
    - Viewed (0)
  5. android/guava-tests/test/com/google/common/io/MoreFilesTest.java

          Path dir = fs.getPath("dir");
          Files.createDirectory(dir);
    
          ByteSource source = MoreFiles.asByteSource(dir);
    
          assertThat(source.sizeIfKnown()).isAbsent();
    
          assertThrows(IOException.class, () -> source.size());
        }
      }
    
      public void testByteSource_size_ofSymlinkToDirectory() throws IOException {
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Thu Oct 31 16:07:00 UTC 2024
    - 26.5K bytes
    - Viewed (0)
  6. android/guava/src/com/google/common/io/MoreFiles.java

         * directly.
         */
        ByteSource source1 = asByteSource(path1);
        ByteSource source2 = asByteSource(path2);
        long len1 = source1.sizeIfKnown().or(0L);
        long len2 = source2.sizeIfKnown().or(0L);
        if (len1 != 0 && len2 != 0 && len1 != len2) {
          return false;
        }
        return source1.contentEquals(source2);
      }
    
      /**
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Thu Oct 31 16:07:00 UTC 2024
    - 35K bytes
    - Viewed (0)
  7. guava/src/com/google/common/io/MoreFiles.java

         * directly.
         */
        ByteSource source1 = asByteSource(path1);
        ByteSource source2 = asByteSource(path2);
        long len1 = source1.sizeIfKnown().or(0L);
        long len2 = source2.sizeIfKnown().or(0L);
        if (len1 != 0 && len2 != 0 && len1 != len2) {
          return false;
        }
        return source1.contentEquals(source2);
      }
    
      /**
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Thu Oct 31 16:07:00 UTC 2024
    - 34.5K bytes
    - Viewed (0)
  8. android/guava/src/com/google/common/io/Files.java

        }
    
        @Override
        public FileInputStream openStream() throws IOException {
          return new FileInputStream(file);
        }
    
        @Override
        public Optional<Long> sizeIfKnown() {
          if (file.isFile()) {
            return Optional.of(file.length());
          } else {
            return Optional.absent();
          }
        }
    
        @Override
        public long size() throws IOException {
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Mon Jul 22 19:03:12 UTC 2024
    - 33.1K bytes
    - Viewed (0)
  9. guava/src/com/google/common/io/Files.java

        }
    
        @Override
        public FileInputStream openStream() throws IOException {
          return new FileInputStream(file);
        }
    
        @Override
        public Optional<Long> sizeIfKnown() {
          if (file.isFile()) {
            return Optional.of(file.length());
          } else {
            return Optional.absent();
          }
        }
    
        @Override
        public long size() throws IOException {
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Mon Jul 22 19:03:12 UTC 2024
    - 33.1K bytes
    - Viewed (0)
Back to top