better.files

package better.files

Members list

Concise view

Type members

Classlikes

class BomEncoder(charset: Charset) extends CharsetEncoder

Encoder that writes the BOM for this charset

Encoder that writes the BOM for this charset

Attributes

Graph
Supertypes
class CharsetEncoder
class Object
trait Matchable
class Any
trait Disposable[-A]

A typeclass to denote a disposable resource

A typeclass to denote a disposable resource

Attributes

Companion:
object
Graph
Supertypes
class Object
trait Matchable
class Any
object Disposable

Attributes

Companion:
trait
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
class Dispose[A](val resource: A)(implicit disposer: Disposable[A])

Given a disposable resource, this actually does the disposing

Given a disposable resource, this actually does the disposing

Attributes

Companion:
object
Graph
Supertypes
class Object
trait Matchable
class Any
object Dispose

Attributes

Companion:
class
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Dispose.type
object Dsl

Do file ops using a UNIX command line DSL

Do file ops using a UNIX command line DSL

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Dsl.type
class File extends Serializable

Scala wrapper around java.nio.files.Path

Scala wrapper around java.nio.files.Path

Attributes

Companion:
object
Graph
Supertypes
trait Serializable
class Object
trait Matchable
class Any
object File

Attributes

Companion:
class
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
File.type
abstract class FileMonitor(val root: File, maxDepth: Int) extends Monitor

Implementation of File.Monitor

Implementation of File.Monitor

Attributes

Graph
Supertypes
trait Monitor
trait AutoCloseable
class Object
trait Matchable
class Any
trait Implicits extends Implicits with Implicits with Implicits

Container for various implicits

Container for various implicits

Attributes

Graph
Supertypes
trait Implicits
trait Implicits
trait Implicits
class Object
trait Matchable
class Any
object NullOutputStream extends OutputStream

A sink outputstream similar to /dev/null - just consumes everything

A sink outputstream similar to /dev/null - just consumes everything

Attributes

Graph
Supertypes
class OutputStream
trait Flushable
trait Closeable
trait AutoCloseable
class Object
trait Matchable
class Any
Self type
class ReaderInputStream(reader: Reader, encoder: CharsetEncoder, bufferSize: Int) extends InputStream

Code ported from Java to Scala: https://github.com/apache/commons-io/blob/c0eb48f7e83987c5ed112b82f0d651aff5149ae4/src/main/java/org/apache/commons/io/input/ReaderInputStream.java

Attributes

Graph
Supertypes
class InputStream
trait Closeable
trait AutoCloseable
class Object
trait Matchable
class Any
trait Resource

Finds and loads class resources or class loader resources.

The default implementation of this trait is the Resource object, which looks up resources using the current thread's context class loader. The Resource object also offers several other Resource implementations, through its methods at, from, and my. at searches from a Class, from searches from a ClassLoader, and my searches from the class, trait, or object surrounding the call.

Attributes

See also:
Example:
        // Look up the config.properties file for this class or object.
        Resource.my.asStream("config.properties")
        // Find logging.properties (in the root package) somewhere on the classpath.
        Resource.url("logging.properties")
Companion:
object
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object Resource.type
object Resource extends Resource

Implementations of Resource.

Implementations of Resource.

This object itself is a Resource uses the current thread's context class loader. It also creates Resources with different lookup behavior, using the methods at, from, and my. at searches rom a Class, from searches from a different ClassLoader, and my searches from the class, trait, or object surrounding the call.

Attributes

See also:
Companion:
trait
Graph
Supertypes
trait Resource
class Object
trait Matchable
class Any
Self type
trait Scannable[A]

Implement this trait to make thing parsable In most cases, use Scanner.Read typeclass when you simply need access to one String token Use Scannable typeclass if you need access to the full scanner e.g. to detect encodings etc.

Implement this trait to make thing parsable In most cases, use Scanner.Read typeclass when you simply need access to one String token Use Scannable typeclass if you need access to the full scanner e.g. to detect encodings etc.

Attributes

Companion:
object
Graph
Supertypes
class Object
trait Matchable
class Any
object Scannable

Attributes

Companion:
trait
Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Attributes

Companion:
object
Graph
Supertypes
class Object
trait Matchable
class Any

Attributes

Companion:
trait
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
class TeeOutputStream(outs: OutputStream*) extends OutputStream

Write to multiple outputstreams at once If error happens on any one while doing an operation, only the last error is reported

Write to multiple outputstreams at once If error happens on any one while doing an operation, only the last error is reported

Attributes

Graph
Supertypes
class OutputStream
trait Flushable
trait Closeable
trait AutoCloseable
class Object
trait Matchable
class Any
class UnicodeCharset(underlyingCharset: Charset, writeByteOrderMarkers: Boolean) extends Charset

A Unicode charset that handles byte-order markers

A Unicode charset that handles byte-order markers

Attributes

underlyingCharset

Use this charset if no known byte-order marker is detected; use this for encoding too

writeByteOrderMarkers

If set, write BOMs while encoding

Companion:
object
Graph
Supertypes
class Charset
trait Comparable[Charset]
class Object
trait Matchable
class Any

Attributes

Companion:
class
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
class UnicodeDecoder(defaultCharset: Charset) extends CharsetDecoder

A Unicode decoder that uses the Unicode byte-order marker (BOM) to auto-detect the encoding (if none detected, falls back on the defaultCharset). This also gets around a bug in the JDK (http://bugs.java.com/bugdatabase/view_bug.do?bug_id=4508058) where BOM is not consumed for UTF-8. See: https://github.com/pathikrit/better-files/issues/107

A Unicode decoder that uses the Unicode byte-order marker (BOM) to auto-detect the encoding (if none detected, falls back on the defaultCharset). This also gets around a bug in the JDK (http://bugs.java.com/bugdatabase/view_bug.do?bug_id=4508058) where BOM is not consumed for UTF-8. See: https://github.com/pathikrit/better-files/issues/107

Attributes

defaultCharset

Use this charset if no known byte-order marker is detected

Graph
Supertypes
class CharsetDecoder
class Object
trait Matchable
class Any
class WriterOutputStream(writer: Writer, decoder: CharsetDecoder, bufferSize: Int, flushImmediately: Boolean) extends OutputStream

Code ported from Java to Scala: https://github.com/apache/commons-io/blob/d357d9d563c4a34fa2ab3cdc68221c851a9de4f5/src/main/java/org/apache/commons/io/output/WriterOutputStream.java

Attributes

Graph
Supertypes
class OutputStream
trait Flushable
trait Closeable
trait AutoCloseable
class Object
trait Matchable
class Any

Inherited classlikes

implicit class BufferedReaderExtensions(reader: BufferedReader)

Attributes

Inherited from:
Implicits
Graph
Supertypes
class Object
trait Matchable
class Any
implicit class DigestInputStreamExtensions(in: DigestInputStream)

Attributes

Inherited from:
Implicits
Graph
Supertypes
class Object
trait Matchable
class Any
implicit class DisposeableExtensions[A](resource: A)(implicit evidence$1: Disposable[A])

Attributes

Inherited from:
Implicits
Graph
Supertypes
class Object
trait Matchable
class Any
implicit class FileChannelExtensions(fc: FileChannel)

Attributes

Inherited from:
Implicits
Graph
Supertypes
class Object
trait Matchable
class Any
implicit class FileExtensions(file: File)

Attributes

Inherited from:
Implicits
Graph
Supertypes
class Object
trait Matchable
class Any
implicit class InputStreamExtensions(in: InputStream)

Attributes

Inherited from:
Implicits
Graph
Supertypes
class Object
trait Matchable
class Any
implicit class IteratorExtensions[A](it: Iterator[A])

Attributes

Inherited from:
Implicits
Graph
Supertypes
class Object
trait Matchable
class Any
implicit class JStreamExtensions[A](stream: Stream[A])

Attributes

Inherited from:
Implicits
Graph
Supertypes
class Object
trait Matchable
class Any
implicit class ObjectInputStreamExtensions(ois: ObjectInputStream)

Attributes

Inherited from:
Implicits
Graph
Supertypes
class Object
trait Matchable
class Any
implicit class ObjectOutputStreamExtensions(val oos: ObjectOutputStream)

Attributes

Inherited from:
Implicits
Graph
Supertypes
class Object
trait Matchable
class Any
implicit class OutputStreamExtensions(val out: OutputStream)

Attributes

Inherited from:
Implicits
Graph
Supertypes
class Object
trait Matchable
class Any
implicit class PathMatcherExtensions(matcher: PathMatcher)

Attributes

Inherited from:
Implicits
Graph
Supertypes
class Object
trait Matchable
class Any
implicit class PrintWriterExtensions(pw: PrintWriter)

Attributes

Inherited from:
Implicits
Graph
Supertypes
class Object
trait Matchable
class Any
implicit class ReaderExtensions(reader: Reader)

Attributes

Inherited from:
Implicits
Graph
Supertypes
class Object
trait Matchable
class Any
implicit class StringExtensions(str: String)

Attributes

Inherited from:
Implicits
Graph
Supertypes
class Object
trait Matchable
class Any
implicit class StringInterpolations(sc: StringContext)

Attributes

Inherited from:
Implicits
Graph
Supertypes
class Object
trait Matchable
class Any
implicit class SymbolExtensions(symbol: Symbol)

Attributes

Inherited from:
Implicits
Graph
Supertypes
class Object
trait Matchable
class Any
implicit class URIExtensions(uri: URI)

Attributes

Inherited from:
Implicits
Graph
Supertypes
class Object
trait Matchable
class Any
implicit class URLExtensions(url: URL)

Attributes

Inherited from:
Implicits
Graph
Supertypes
class Object
trait Matchable
class Any
implicit class WriterExtensions(writer: Writer)

Attributes

Inherited from:
Implicits
Graph
Supertypes
class Object
trait Matchable
class Any
implicit class ZipEntryExtensions(val entry: ZipEntry)

Attributes

Inherited from:
Implicits
Graph
Supertypes
class Object
trait Matchable
class Any
implicit class ZipInputStreamExtensions(val in: ZipInputStream)

Attributes

Inherited from:
Implicits
Graph
Supertypes
class Object
trait Matchable
class Any
implicit class ZipOutputStreamExtensions(val out: ZipOutputStream)

Attributes

Inherited from:
Implicits
Graph
Supertypes
class Object
trait Matchable
class Any
object dispose extends FlatMap[Dispose]

Compose this managed resource with another managed resource closing the outer one after the inner one

Compose this managed resource with another managed resource closing the outer one after the inner one

Attributes

Inherited from:
Implicits
Graph
Supertypes
class Object
trait Matchable
class Any
object iterable extends FlatMap[IterableOnce]

Use the current managed resource as a generator needed to create another sequence

Use the current managed resource as a generator needed to create another sequence

Attributes

Inherited from:
Implicits
Graph
Supertypes
trait FlatMap[IterableOnce]
class Object
trait Matchable
class Any

Value members

Concrete methods

def using[A : Disposable, B](resource: A)(f: A => B): B

Similar to the with keyword in Python and using keyword in .NET and try-with-resource syntax in Java, this let's you use and dispose a resource e.g.

Similar to the with keyword in Python and using keyword in .NET and try-with-resource syntax in Java, this let's you use and dispose a resource e.g.

{{ val lines: List[String] = using(file.newInputStream) { stream => stream.lines.toList // Must be eager so .toList } }}

Attributes

Inherited methods

def temporalQuery[A](format: DateTimeFormatter, query: TemporalQuery[A]): Read[A]

Use this to create custom readers e.g. to read a LocalDate using some custom format val readLocalDate: Read[LocalDate] = Read.temporalQuery(format = myFormat, query = LocalDate.from)

Use this to create custom readers e.g. to read a LocalDate using some custom format val readLocalDate: Read[LocalDate] = Read.temporalQuery(format = myFormat, query = LocalDate.from)

Attributes

Inherited from:
Implicits

Concrete fields

Default array buffer size Seems like a good value used by JDK: (see: java.io.BufferedInputStream.DEFAULT_BUFFER_SIZE)

Default array buffer size Seems like a good value used by JDK: (see: java.io.BufferedInputStream.DEFAULT_BUFFER_SIZE)

Attributes

val DefaultCharset: Charset

The Default charset used by better-files Note: It uses java.net.charset.Charset.DefaultCharset() in general but if the Default supports byte-order markers, it uses a more compliant version than the JDK one (see: https://github.com/pathikrit/better-files/issues/107)

The Default charset used by better-files Note: It uses java.net.charset.Charset.DefaultCharset() in general but if the Default supports byte-order markers, it uses a more compliant version than the JDK one (see: https://github.com/pathikrit/better-files/issues/107)

Attributes

val EOF: Int

Implicits

Inherited implicits

final implicit def BufferedReaderExtensions(reader: BufferedReader): BufferedReaderExtensions

Attributes

Inherited from:
Implicits
final implicit def DigestInputStreamExtensions(in: DigestInputStream): DigestInputStreamExtensions

Attributes

Inherited from:
Implicits
final implicit def DisposeableExtensions[A : Disposable](resource: A): DisposeableExtensions[A]

Attributes

Inherited from:
Implicits
final implicit def FileChannelExtensions(fc: FileChannel): FileChannelExtensions

Attributes

Inherited from:
Implicits
final implicit def FileExtensions(file: File): FileExtensions

Attributes

Inherited from:
Implicits
final implicit def InputStreamExtensions(in: InputStream): InputStreamExtensions

Attributes

Inherited from:
Implicits
final implicit def IteratorExtensions[A](it: Iterator[A]): IteratorExtensions[A]

Attributes

Inherited from:
Implicits
final implicit def JStreamExtensions[A](stream: Stream[A]): JStreamExtensions[A]

Attributes

Inherited from:
Implicits
final implicit def ObjectInputStreamExtensions(ois: ObjectInputStream): ObjectInputStreamExtensions

Attributes

Inherited from:
Implicits
final implicit def ObjectOutputStreamExtensions(oos: ObjectOutputStream): ObjectOutputStreamExtensions

Attributes

Inherited from:
Implicits
final implicit def OutputStreamExtensions(out: OutputStream): OutputStreamExtensions

Attributes

Inherited from:
Implicits
final implicit def PathMatcherExtensions(matcher: PathMatcher): PathMatcherExtensions

Attributes

Inherited from:
Implicits
final implicit def PrintWriterExtensions(pw: PrintWriter): PrintWriterExtensions

Attributes

Inherited from:
Implicits
final implicit def ReaderExtensions(reader: Reader): ReaderExtensions

Attributes

Inherited from:
Implicits
final implicit def StringExtensions(str: String): StringExtensions

Attributes

Inherited from:
Implicits
final implicit def StringInterpolations(sc: StringContext): StringInterpolations

Attributes

Inherited from:
Implicits
final implicit def SymbolExtensions(symbol: Symbol): SymbolExtensions

Attributes

Inherited from:
Implicits
final implicit def URIExtensions(uri: URI): URIExtensions

Attributes

Inherited from:
Implicits
final implicit def URLExtensions(url: URL): URLExtensions

Attributes

Inherited from:
Implicits
final implicit def WriterExtensions(writer: Writer): WriterExtensions

Attributes

Inherited from:
Implicits
final implicit def ZipEntryExtensions(entry: ZipEntry): ZipEntryExtensions

Attributes

Inherited from:
Implicits
final implicit def ZipInputStreamExtensions(in: ZipInputStream): ZipInputStreamExtensions

Attributes

Inherited from:
Implicits
final implicit def ZipOutputStreamExtensions(out: ZipOutputStream): ZipOutputStreamExtensions

Attributes

Inherited from:
Implicits
implicit val bigDecimalRead: Read[BigDecimal]

Attributes

Inherited from:
Implicits
implicit val bigIntRead: Read[BigInt]

Attributes

Inherited from:
Implicits
implicit val booleanRead: Read[Boolean]

Attributes

Inherited from:
Implicits
implicit val bufferedReaderSource: Source[BufferedReader]

Attributes

Inherited from:
Implicits
implicit val byteRead: Read[Byte]

Attributes

Inherited from:
Implicits
implicit val doubleRead: Read[Double]

Attributes

Inherited from:
Implicits
implicit val durationRead: Read[Duration]

Attributes

Inherited from:
Implicits
implicit val floatRead: Read[Float]

Attributes

Inherited from:
Implicits
implicit def inputstreamSource(implicit charset: Charset): Source[InputStream]

Attributes

Inherited from:
Implicits
implicit val instantRead: Read[Instant]

Attributes

Inherited from:
Implicits
implicit val intRead: Read[Int]

Attributes

Inherited from:
Implicits
implicit val lineNumberReaderSource: Source[LineNumberReader]

Attributes

Inherited from:
Implicits
implicit val localDateRead: Read[LocalDate]

Attributes

Inherited from:
Implicits
implicit val localDateTimeRead: Read[LocalDateTime]

Attributes

Inherited from:
Implicits
implicit val longRead: Read[Long]

Attributes

Inherited from:
Implicits
implicit val monthDayRead: Read[MonthDay]

Attributes

Inherited from:
Implicits
implicit val offsetDateTimeRead: Read[OffsetDateTime]

Attributes

Inherited from:
Implicits
implicit val offsetTimeRead: Read[OffsetTime]

Attributes

Inherited from:
Implicits
implicit def optionRead[A : Read]: Read[Option[A]]

Attributes

Inherited from:
Implicits
implicit val periodRead: Read[Period]

Attributes

Inherited from:
Implicits
implicit val readerSource: Source[Reader]

Attributes

Inherited from:
Implicits
implicit val shortRead: Read[Short]

Attributes

Inherited from:
Implicits
implicit val sqlDateRead: Read[Date]

Attributes

Inherited from:
Implicits
implicit val sqlTimeRead: Read[Time]

Attributes

Inherited from:
Implicits
implicit val sqlTimestampRead: Read[Timestamp]

Attributes

Inherited from:
Implicits
implicit val stringRead: Read[String]

Attributes

Inherited from:
Implicits
implicit val stringSource: Source[String]

Attributes

Inherited from:
Implicits
implicit def stringToCharset(charsetName: String): Charset

Attributes

Inherited from:
Implicits
implicit def stringToMessageDigest(algorithmName: String): MessageDigest

Attributes

Inherited from:
Implicits
implicit def tokenizerToIterator(s: StringTokenizer): Iterator[String]

Attributes

Inherited from:
Implicits
implicit val yearMonthRead: Read[YearMonth]

Attributes

Inherited from:
Implicits
implicit val yearRead: Read[Year]

Attributes

Inherited from:
Implicits
implicit val zonedDateTimeRead: Read[ZonedDateTime]

Attributes

Inherited from:
Implicits