Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 7 of 7 for sizeIfKnown (0.21 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;
    Java
    - Registered: Fri Apr 26 12:43:10 GMT 2024
    - Last Modified: Wed May 17 14:35:11 GMT 2023
    - 26.2K bytes
    - Viewed (0)
  2. android/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(
    Java
    - Registered: Fri Apr 26 12:43:10 GMT 2024
    - Last Modified: Wed Sep 06 17:04:31 GMT 2023
    - 8.6K bytes
    - Viewed (0)
  3. 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(
    Java
    - Registered: Fri Apr 19 12:43:09 GMT 2024
    - Last Modified: Wed Sep 06 17:04:31 GMT 2023
    - 8.6K bytes
    - Viewed (0)
  4. 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
    Java
    - Registered: Fri Apr 19 12:43:09 GMT 2024
    - Last Modified: Mon Oct 10 19:45:10 GMT 2022
    - 5.2K bytes
    - Viewed (0)
  5. 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
    Java
    - Registered: Fri Apr 26 12:43:10 GMT 2024
    - Last Modified: Mon Oct 10 19:45:10 GMT 2022
    - 5.2K bytes
    - Viewed (0)
  6. 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 {
    Java
    - Registered: Fri Apr 19 12:43:09 GMT 2024
    - Last Modified: Mon Jan 29 22:57:05 GMT 2024
    - 27.2K bytes
    - Viewed (0)
  7. 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 {
    Java
    - Registered: Fri Apr 26 12:43:10 GMT 2024
    - Last Modified: Thu Feb 15 16:12:13 GMT 2024
    - 33.1K bytes
    - Viewed (0)
Back to top