scalax.io.processing

OpenSeekable

class OpenSeekable extends OpenOutput

The Processor API object for performing seekable operations within a processing pipeline.

This is an extension of scalax.io.processing.OpenOutput and that class should be viewed for details on how to use this class. In fact an even better resource is scalax.io.processing.OutputProcessor since it has good examples.

See also

scalax.io.processing.OutputProcessor

scalax.io.processing.OpenOutput

Linear Supertypes
OpenOutput, AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. OpenSeekable
  2. OpenOutput
  3. AnyRef
  4. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  4. def append(string: String)(implicit codec: Codec = Codec.default): Processor[Unit]

    Append a string to the end of the Seekable object.

    Append a string to the end of the Seekable object.

    string

    the data to write

    codec

    the codec of the string to be written. The string will be converted to the encoding of { @link codec}

  5. def append[T](data: T)(implicit converter: OutputConverter[T]): Processor[Unit]

    Append bytes to the end of a file

    Append bytes to the end of a file

    Important: The use of an Array is highly recommended because normally arrays can be more efficiently written using the underlying APIs

    data

    The data to write. This can be any type that has a scalax.io.OutputConverter associated with it. There are predefined $outputConverters for several types. See the scalax.io.OutputConverter object for the predefined types and for objects to simplify implementing custom scalax.io.OutputConverter

    $converterParam

  6. def appendIntsAsBytes(data: Int*): Processor[Unit]

    Since the scalax.io.OutputConverter object defined for writing Ints encodes Ints using 4 bytes this method is provided to simply write an array of Ints as if they are Bytes.

    Since the scalax.io.OutputConverter object defined for writing Ints encodes Ints using 4 bytes this method is provided to simply write an array of Ints as if they are Bytes. In other words just taking the first byte. This is pretty common in Java.io style IO. IE

    outputStream.write(1)

    1 is written as a single byte.

  7. def appendStrings(strings: Traversable[String], separator: String = "")(implicit codec: Codec = Codec.default): Processor[Unit]

    Append several strings to the end of the Seekable object.

    Append several strings to the end of the Seekable object.

    strings

    The strings to write

    separator

    A string to add between each string. It is not added to the before the first string or after the last.

    codec

    The codec of the strings to be written. The strings will be converted to the encoding of { @link codec}

  8. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  9. val asOutput: Output

    Definition Classes
    OpenOutput
  10. val asSeekable: Seekable { ... /* 2 definitions in type refinement */ }

  11. def blocks(blockSize: Option[Int] = None): CloseableIteratorProcessor[ByteBlock]

    Read the input as blocks of bytes.

    Read the input as blocks of bytes. This method should be avoided unless the maximum performance is absolutely required because bytes provides very good performance and is a better API for most applications.

    However since it better reflects how data is read with most input sources (like InputStreams and ReadableByteChannels); blocks is slightly more performance than bytes and therefore can be used when performance is the most important consideration.

    blockSize

    block size can optionally be specified but the default is normally acceptable.

  12. def byteArray: Processor[Array[Byte]]

    This method aspires to be the fastest way to read a stream of known length into memory.

  13. def bytes: CloseableIteratorProcessor[Byte]

    Obtains a Traversable for conveniently processing the resource as bytes.

    Obtains a Traversable for conveniently processing the resource as bytes.

    returns

  14. def bytesAsInts: CloseableIteratorProcessor[Int]

    Obtains a Traversable for conveniently processing the file as Ints.

    Obtains a Traversable for conveniently processing the file as Ints.

    returns

    an non-strict traversable over all the bytes with the bytes being represented as Ints

  15. def chars(implicit codec: Codec = Codec.default): CloseableIteratorProcessor[Char]

    The characters in the object.

    The characters in the object.

    If the codec is not the same as the source codec (the codec of the underlying data) then the characters will converted to the desired codec.

    codec

    The codec representing the desired encoding of the characters

    returns

    an traversable of all the characters

  16. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  17. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  18. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  19. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  20. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  21. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  22. def insert[T](position: Long, data: T)(implicit converter: OutputConverter[T]): Processor[Unit]

    Inserts data at a position in the Seekable.

    Inserts data at a position in the Seekable. The actual position in the Seekable where the data is inserted depends on the type of data being written. For example if Longs are being written then position calculated as position * 8

    Important: The use of an Array is highly recommended because normally arrays can be more efficiently written using the underlying APIs

    position

    The position where the data is inserted into the Seekable. The actual position in the Seekable where the data is inserted depends on the type of data being written. For example if Longs are being written then position calculated as position * 8

    data

    The data to write. This can be any type that has a scalax.io.OutputConverter associated with it. There are predefined $outputConverters for several types. See the scalax.io.OutputConverter object for the predefined types and for objects to simplify implementing custom scalax.io.OutputConverter

    $converterParam

  23. def insert(position: Long, string: String)(implicit codec: Codec = Codec.default): Processor[Unit]

    Inserts a string at a position in the Seekable.

    Inserts a string at a position in the Seekable. This is a potentially inefficient because of the need to count characters. If the codec is not a fixed sized codec (for example UTF8) each character must be converted in the file up to the point of insertion.

    position

    The position in the file to perform the insert. A position of 2 will insert the character after the second character (not byte).

    string

    The string that will be inserted into the Seekable

    codec

    The codec to use for determining the location for inserting the string and for encoding the string as bytes

  24. def insertIntsAsBytes(position: Long, data: Int*): Processor[Unit]

    Since the scalax.io.OutputConverter object defined for writing Ints encodes Ints using 4 bytes this method is provided to simply write an array of Ints as if they are Bytes.

    Since the scalax.io.OutputConverter object defined for writing Ints encodes Ints using 4 bytes this method is provided to simply write an array of Ints as if they are Bytes. In other words just taking the first byte. This is pretty common in Java.io style IO. IE

    outputStream.write(1)

    1 is written as a single byte.

  25. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  26. def lines(terminator: Terminator = Auto, includeTerminator: Boolean = false)(implicit codec: Codec = Codec.default): CloseableIteratorProcessor[String]

    Obtain an non-strict traversable for iterating through the lines in the object

    Obtain an non-strict traversable for iterating through the lines in the object

    If the codec is not the same as the source codec (the codec of the underlying data) then the characters will converted to the desired codec.

    terminator

    The strategy for determining the end of line Default is to auto-detect the EOL

    includeTerminator

    if true then the line will end with the line terminator Default is false

    codec

    The codec representing the desired encoding of the characters

    returns

    a non-strict traversable for iterating through all the lines

  27. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  28. final def notify(): Unit

    Definition Classes
    AnyRef
  29. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  30. def patch[T](position: Long, data: T, overwrite: Overwrite)(implicit converter: OutputConverter[T]): Processor[Unit]

    Update a portion of the file content at the declared location.

    Update a portion of the file content at the declared location. This is the most flexible of the random access methods but is also (probably) the trickiest to fully understand. That said it behaves (almost) identical to a scala.collection.Seq.patch method, so if you understand that you should not have difficulty understanding this method.

    Important: The use of an Array is highly recommended because normally arrays can be more efficiently written using the underlying APIs

    To append data the position must >= size

    If the position is within the file but the position + bytes.length is beyond the end of the file the file will be enlarged so that the entire string can fit in the file

    The write begins at the position indicated. So if position = 0 then the write will begin at the first byte of the file.

    position

    The start position of the update starting at 0. The position must be within the file or == size (for appending)

    data

    The data to write. This can be any type that has a scalax.io.OutputConverter associated with it. There are predefined $outputConverters for several types. See the scalax.io.OutputConverter object for the predefined types and for objects to simplify implementing custom scalax.io.OutputConverter

    overwrite

    The strategy that dictates how many characters/bytes/units are overwritten $converterParam

  31. def patch(position: Long, string: String, overwrite: Overwrite)(implicit codec: Codec = Codec.default): Processor[Unit]

    Update a portion of the file content at the declared location.

    Update a portion of the file content at the declared location. This is the most flexible of the random access methods but is also (probably) the trickiest to fully understand. That said it behaves (almost) identical to a scala.collection.Seq.patch method, so if you understand that you should not have difficulty understanding this method.

    If the position is beyond the end of the file a BufferUnderflow Exception will be thrown

    If the position is within the file but the position + string.getBytes(codec).length is beyond the end of the file the file will be enlarged so that the entire string can fit in the file

    The write begins at the position indicated. So if position = 0 then the write will begin at the first byte of the file.

    position

    The start position of the update starting at 0. The position is the position'th character in the file using the codec for decoding the file The position must be within the file.

    string

    The string to write to the file starting at position.

    overwrite

    The strategy that dictates how many characters/bytes/units are overwritten

    codec

    The codec to use for decoding the underlying data into characters

  32. def patchIntsAsBytes(position: Long, overwrite: Overwrite, data: Int*): Processor[Unit]

    Since the scalax.io.OutputConverter object defined for writing Ints encodes Ints using 4 bytes this method is provided to simply write an array of Ints as if they are Bytes.

    Since the scalax.io.OutputConverter object defined for writing Ints encodes Ints using 4 bytes this method is provided to simply write an array of Ints as if they are Bytes. In other words just taking the first byte. This is pretty common in Java.io style IO. IE

    outputStream.write(1)

    1 is written as a single byte.

  33. def position: Processor[Long]

  34. def position_=(newPosition: Long): Processor[Unit]

  35. def size: Processor[Long]

  36. def string(implicit codec: Codec = Codec.default): Processor[String]

    Loads all the characters into memory.

    Loads all the characters into memory. There is no protection against loading very large files/amounts of data.

    codec

    The codec representing the desired encoding of the characters

  37. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  38. def toString(): String

    Definition Classes
    AnyRef → Any
  39. def truncate(position: Long): Processor[Unit]

    Truncate/Chop the Seekable to the number of bytes declared by the position param

  40. def truncateString(position: Long)(implicit codec: Codec = Codec.default): Processor[Unit]

  41. val uncloseableChannel: WritableByteChannel

    Definition Classes
    OpenOutput
  42. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  43. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  44. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  45. def write(string: String)(implicit codec: Codec = Codec.default): Processor[Unit]

    Writes a string.

    Writes a string.

    string

    the data to write

    codec

    the codec of the string to be written. The string will be converted to the encoding of { @link sourceCodec} Default is sourceCodec

    returns

    a unit processor

    Definition Classes
    OpenOutput
  46. def write[T](data: T)(implicit writer: OutputConverter[T]): Processor[Unit]

    Write data to the underlying object.

    Write data to the underlying object. Each time write is called the resource is reopened, in the case of a file this means that the file will be opened and truncated. The

    In the case of writing ints and bytes it is often recommended to write arrays of data since normally the underlying object can write arrays of bytes or integers most efficiently.

    Since Characters require a codec to write to an OutputStream characters cannot be written with this method unless a OutputWriterFunction.CharFunction object is provided as the writer.

    data

    The data to write to underlying object. Any data that has a resolvable scalax.io.OutputConverter can be written. See the scalax.io.OutputConverter object for the defined scalax.io.OutputConverter implementations and classes to assist implementing more.

    writer

    The strategy used to write the data to the underlying object. Many standard data-types are implicitly resolved and do not need to be supplied

    returns

    a unit processor

    Definition Classes
    OpenOutput
    See also

    #writeChars for more on writing characters

  47. def writeChars(characters: TraversableOnce[Char])(implicit codec: Codec = Codec.default): Processor[Unit]

    Definition Classes
    OpenOutput
  48. def writeIntsAsBytes(data: Int*): Processor[Unit]

    Since the scalax.io.OutputConverter object defined for writing Ints encodes Ints using 4 bytes this method is provided to simply write an array of Ints as if they are Bytes.

    Since the scalax.io.OutputConverter object defined for writing Ints encodes Ints using 4 bytes this method is provided to simply write an array of Ints as if they are Bytes. In other words just taking the first byte. This is pretty common in Java.io style IO. IE

    outputStream.write(1)

    1 is written as a single byte.

    returns

    a unit processor

    Definition Classes
    OpenOutput
  49. def writeStrings(strings: Traversable[String], separator: String = "")(implicit codec: Codec = Codec.default): Processor[Unit]

    Write several strings.

    Write several strings.

    strings

    The data to write

    separator

    A string to add between each string. It is not added to the before the first string or after the last.

    codec

    The codec of the strings to be written. The strings will be converted to the encoding of { @link sourceCodec}

    returns

    a unit processor

    Definition Classes
    OpenOutput

Inherited from OpenOutput

Inherited from AnyRef

Inherited from Any

Ungrouped