Movatterモバイル変換


[0]ホーム

URL:


Scala 3
3.7.4
LearnInstallPlaygroundFind A LibraryCommunityBlog
Scala 3
LearnInstallPlaygroundFind A LibraryCommunityBlog
DocsAPI
Generated with
Copyright (c) 2002-2025, LAMP/EPFL
Copyright (c) 2002-2025, LAMP/EPFL
Scala 3/scala/scala.sys/scala.sys.process/BasicIO

BasicIO

scala.sys.process.BasicIO
objectBasicIO

This object contains factories forscala.sys.process.ProcessIO, which can be used to control the I/O of ascala.sys.process.Process when ascala.sys.process.ProcessBuilder is started with therun command.

It also contains some helper methods that can be used to in the creation ofProcessIO.

It is used by other classes in the package in the implementation of various features, but can also be used by client code.

Attributes

Source
BasicIO.scala
Graph
Supertypes
classObject
traitMatchable
classAny
Self type
BasicIO.type

Members list

Value members

Concrete methods

Creates aProcessIO from a functionString => Unit.

Creates aProcessIO from a functionString => Unit. It can attach the process input to stdin, and it will either send the error stream to stderr, or to aProcessLogger.

For example, theProcessIO created below will print all normal output while ignoring all error output. No input will be provided.

import scala.sys.process.BasicIOval errToDevNull = BasicIO(false, println(_), None)

Value parameters

log

An optionalProcessLogger to which the output should be sent. IfNone, output will be sent to stderr.

output

A function that will be called with the process output.

withIn

True if the process input should be attached to stdin.

Attributes

Returns

AProcessIO with the characteristics above.

Source
BasicIO.scala

Creates aProcessIO that appends its output to anAppendable.

Creates aProcessIO that appends its output to anAppendable. It can attach the process input to stdin, and it will either send the error stream to stderr, or to aProcessLogger.

For example, theProcessIO created by the function below will store the normal output on the buffer provided, and print all error on stderr. The input will be read from stdin.

import scala.sys.process.{BasicIO, ProcessLogger}val printer = ProcessLogger(println(_))def appendToBuffer(b: StringBuffer) = BasicIO(true, b, Some(printer))

Value parameters

buffer

AnAppendable which will receive the process normal output.

log

An optionalProcessLogger to which the output should be sent. IfNone, output will be sent to stderr.

withIn

True if the process input should be attached to stdin.

Attributes

Returns

AProcessIO with the characteristics above.

Source
BasicIO.scala

Creates aProcessIO from aProcessLogger.

Creates aProcessIO from aProcessLogger. It can attach the process input to stdin.

Value parameters

log

AProcessLogger to receive all output, normal and error.

withIn

True if the process input should be attached to stdin.

Attributes

Returns

AProcessIO with the characteristics above.

Source
BasicIO.scala
defclose(c:Closeable):Unit

Closes aCloseable without throwing an exception

Closes aCloseable without throwing an exception

Attributes

Source
BasicIO.scala
defconnectToIn(o:OutputStream):Unit

Copy contents of stdin to theOutputStream.

Copy contents of stdin to theOutputStream.

Attributes

Source
BasicIO.scala
defgetErr(log:Option[ProcessLogger]):InputStream=>Unit

Returns a functionInputStream => Unit given an optionalProcessLogger.

Returns a functionInputStream => Unit given an optionalProcessLogger. If no logger is passed, the function will send the output to stderr. This function can be used to create ascala.sys.process.ProcessIO.

Value parameters

log

An optionalProcessLogger to which the contents of theInputStream will be sent.

Attributes

Returns

A functionInputStream => Unit (used byscala.sys.process.ProcessIO) which will send the data to either the providedProcessLogger or, ifNone, to stderr.

Source
BasicIO.scala
definput(connect:Boolean):OutputStream=>Unit

Returns a functionOutputStream => Unit that either reads the content from stdin or does nothing but close the stream.

Returns a functionOutputStream => Unit that either reads the content from stdin or does nothing but close the stream. This function can be used byscala.sys.process.ProcessIO.

Attributes

Source
BasicIO.scala
defprocessFully(buffer:Appendable):InputStream=>Unit

Returns a functionInputStream => Unit that appends all data read to the providedAppendable.

Returns a functionInputStream => Unit that appends all data read to the providedAppendable. This function can be used to create ascala.sys.process.ProcessIO. The buffer will be appended line by line.

Value parameters

buffer

AnAppendable such asStringBuilder orStringBuffer.

Attributes

Returns

A functionInputStream => Unit (used byscala.sys.process.ProcessIO which will append all data read from the stream to the buffer.

Source
BasicIO.scala
defprocessFully(processLine:String=>Unit):InputStream=>Unit

Returns a functionInputStream => Unit that will call the passed function with all data read.

Returns a functionInputStream => Unit that will call the passed function with all data read. This function can be used to create ascala.sys.process.ProcessIO. TheprocessLine function will be called with each line read, andNewline will be appended after each line.

Value parameters

processLine

A function that will be called with all data read from the stream.

Attributes

Returns

A functionInputStream => Unit (used byscala.sys.process.ProcessIO which will callprocessLine with all data read from the stream.

Source
BasicIO.scala
defprocessLinesFully(processLine:String=>Unit)(readLine: ()=>String):Unit

CallsprocessLine with the result ofreadLine until the latter returnsnull or the current thread is interrupted.

CallsprocessLine with the result ofreadLine until the latter returnsnull or the current thread is interrupted.

Attributes

Source
BasicIO.scala
defstandard(connectInput:Boolean):ProcessIO

Returns aProcessIO connected to stdout and stderr, and, optionally, stdin.

Returns aProcessIO connected to stdout and stderr, and, optionally, stdin.

Attributes

Source
BasicIO.scala
defstandard(in:OutputStream=>Unit):ProcessIO

Returns aProcessIO connected to stdout, stderr and the providedin

Returns aProcessIO connected to stdout, stderr and the providedin

Attributes

Source
BasicIO.scala
deftoStdErr:InputStream=>Unit

Send all the input from the stream to stderr, and closes the input stream afterwards.

Send all the input from the stream to stderr, and closes the input stream afterwards.

Attributes

Source
BasicIO.scala
deftoStdOut:InputStream=>Unit

Send all the input from the stream to stdout, and closes the input stream afterwards.

Send all the input from the stream to stdout, and closes the input stream afterwards.

Attributes

Source
BasicIO.scala
deftransferFully(in:InputStream,out:OutputStream):Unit

Copy all input from the input stream to the output stream.

Copy all input from the input stream to the output stream. Closes the input stream once it's all read.

Attributes

Source
BasicIO.scala

Concrete fields

finalvalBufferSize: 8192

Size of the buffer used in all the functions that copy data

Size of the buffer used in all the functions that copy data

Attributes

Source
BasicIO.scala
finalvalNewline:String

Used to separate lines in theprocessFully function that takesAppendable.

Used to separate lines in theprocessFully function that takesAppendable.

Attributes

Source
BasicIO.scala
In this article
Generated with
Copyright (c) 2002-2025, LAMP/EPFL
Copyright (c) 2002-2025, LAMP/EPFL

[8]ページ先頭

©2009-2025 Movatter.jp