| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
| <!-- NewPage --> |
| <html lang="en"> |
| <head> |
| <!-- Generated by javadoc (1.8.0_151-google-v7) on Tue Oct 02 14:37:32 PDT 2018 --> |
| <title>TextIO (Apache Beam 2.7.0-SNAPSHOT)</title> |
| <meta name="date" content="2018-10-02"> |
| <link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style"> |
| <script type="text/javascript" src="../../../../../script.js"></script> |
| </head> |
| <body> |
| <script type="text/javascript"><!-- |
| try { |
| if (location.href.indexOf('is-external=true') == -1) { |
| parent.document.title="TextIO (Apache Beam 2.7.0-SNAPSHOT)"; |
| } |
| } |
| catch(err) { |
| } |
| //--> |
| var methods = {"i0":9,"i1":9,"i2":9,"i3":9,"i4":9,"i5":9}; |
| var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],8:["t4","Concrete Methods"]}; |
| var altColor = "altColor"; |
| var rowColor = "rowColor"; |
| var tableTab = "tableTab"; |
| var activeTableTab = "activeTableTab"; |
| </script> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| <!-- ========= START OF TOP NAVBAR ======= --> |
| <div class="topNav"><a name="navbar.top"> |
| <!-- --> |
| </a> |
| <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> |
| <a name="navbar.top.firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../../../../overview-summary.html">Overview</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="navBarCell1Rev">Class</li> |
| <li><a href="package-tree.html">Tree</a></li> |
| <li><a href="../../../../../deprecated-list.html">Deprecated</a></li> |
| <li><a href="../../../../../index-all.html">Index</a></li> |
| <li><a href="../../../../../help-doc.html">Help</a></li> |
| </ul> |
| </div> |
| <div class="subNav"> |
| <ul class="navList"> |
| <li><a href="../../../../../org/apache/beam/sdk/io/Source.Reader.html" title="class in org.apache.beam.sdk.io"><span class="typeNameLink">Prev Class</span></a></li> |
| <li><a href="../../../../../org/apache/beam/sdk/io/TextIO.CompressionType.html" title="enum in org.apache.beam.sdk.io"><span class="typeNameLink">Next Class</span></a></li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="../../../../../index.html?org/apache/beam/sdk/io/TextIO.html" target="_top">Frames</a></li> |
| <li><a href="TextIO.html" target="_top">No Frames</a></li> |
| </ul> |
| <ul class="navList" id="allclasses_navbar_top"> |
| <li><a href="../../../../../allclasses-noframe.html">All Classes</a></li> |
| </ul> |
| <div> |
| <script type="text/javascript"><!-- |
| allClassesLink = document.getElementById("allclasses_navbar_top"); |
| if(window==top) { |
| allClassesLink.style.display = "block"; |
| } |
| else { |
| allClassesLink.style.display = "none"; |
| } |
| //--> |
| </script> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li><a href="#nested.class.summary">Nested</a> | </li> |
| <li>Field | </li> |
| <li>Constr | </li> |
| <li><a href="#method.summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li>Field | </li> |
| <li>Constr | </li> |
| <li><a href="#method.detail">Method</a></li> |
| </ul> |
| </div> |
| <a name="skip.navbar.top"> |
| <!-- --> |
| </a></div> |
| <!-- ========= END OF TOP NAVBAR ========= --> |
| <!-- ======== START OF CLASS DATA ======== --> |
| <div class="header"> |
| <div class="subTitle">org.apache.beam.sdk.io</div> |
| <h2 title="Class TextIO" class="title">Class TextIO</h2> |
| </div> |
| <div class="contentContainer"> |
| <ul class="inheritance"> |
| <li>java.lang.Object</li> |
| <li> |
| <ul class="inheritance"> |
| <li>org.apache.beam.sdk.io.TextIO</li> |
| </ul> |
| </li> |
| </ul> |
| <div class="description"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <hr> |
| <br> |
| <pre>public class <span class="typeNameLabel">TextIO</span> |
| extends java.lang.Object</pre> |
| <div class="block"><a href="../../../../../org/apache/beam/sdk/transforms/PTransform.html" title="class in org.apache.beam.sdk.transforms"><code>PTransform</code></a>s for reading and writing text files. |
| |
| <h2>Reading text files</h2> |
| |
| <p>To read a <a href="../../../../../org/apache/beam/sdk/values/PCollection.html" title="class in org.apache.beam.sdk.values"><code>PCollection</code></a> from one or more text files, use <code>TextIO.read()</code> to |
| instantiate a transform and use <a href="../../../../../org/apache/beam/sdk/io/TextIO.Read.html#from-java.lang.String-"><code>TextIO.Read.from(String)</code></a> to specify the path of the |
| file(s) to be read. Alternatively, if the filenames to be read are themselves in a <a href="../../../../../org/apache/beam/sdk/values/PCollection.html" title="class in org.apache.beam.sdk.values"><code>PCollection</code></a>, apply <a href="../../../../../org/apache/beam/sdk/io/TextIO.html#readAll--"><code>readAll()</code></a> or <a href="../../../../../org/apache/beam/sdk/io/TextIO.html#readFiles--"><code>readFiles()</code></a>. |
| |
| <p><a href="../../../../../org/apache/beam/sdk/io/TextIO.html#read--"><code>read()</code></a> returns a <a href="../../../../../org/apache/beam/sdk/values/PCollection.html" title="class in org.apache.beam.sdk.values"><code>PCollection</code></a> of <code>Strings</code>, each corresponding to |
| one line of an input UTF-8 text file (split into lines delimited by '\n', '\r', or '\r\n', or |
| specified delimiter see <a href="../../../../../org/apache/beam/sdk/io/TextIO.Read.html#withDelimiter-byte:A-"><code>TextIO.Read.withDelimiter(byte[])</code></a>). |
| |
| <h3>Filepattern expansion and watching</h3> |
| |
| <p>By default, the filepatterns are expanded only once. <a href="../../../../../org/apache/beam/sdk/io/TextIO.Read.html#watchForNewFiles-org.joda.time.Duration-org.apache.beam.sdk.transforms.Watch.Growth.TerminationCondition-"><code>TextIO.Read.watchForNewFiles(org.joda.time.Duration, org.apache.beam.sdk.transforms.Watch.Growth.TerminationCondition<java.lang.String, ?>)</code></a> and <a href="../../../../../org/apache/beam/sdk/io/TextIO.ReadAll.html#watchForNewFiles-org.joda.time.Duration-org.apache.beam.sdk.transforms.Watch.Growth.TerminationCondition-"><code>TextIO.ReadAll.watchForNewFiles(org.joda.time.Duration, org.apache.beam.sdk.transforms.Watch.Growth.TerminationCondition<java.lang.String, ?>)</code></a> allow streaming of new files matching the filepattern(s). |
| |
| <p>By default, <a href="../../../../../org/apache/beam/sdk/io/TextIO.html#read--"><code>read()</code></a> prohibits filepatterns that match no files, and <a href="../../../../../org/apache/beam/sdk/io/TextIO.html#readAll--"><code>readAll()</code></a> |
| allows them in case the filepattern contains a glob wildcard character. Use <a href="../../../../../org/apache/beam/sdk/io/TextIO.Read.html#withEmptyMatchTreatment-org.apache.beam.sdk.io.fs.EmptyMatchTreatment-"><code>TextIO.Read.withEmptyMatchTreatment(org.apache.beam.sdk.io.fs.EmptyMatchTreatment)</code></a> and <a href="../../../../../org/apache/beam/sdk/io/TextIO.ReadAll.html#withEmptyMatchTreatment-org.apache.beam.sdk.io.fs.EmptyMatchTreatment-"><code>TextIO.ReadAll.withEmptyMatchTreatment(org.apache.beam.sdk.io.fs.EmptyMatchTreatment)</code></a> to |
| configure this behavior. |
| |
| <p>Example 1: reading a file or filepattern. |
| |
| <pre><code> |
| Pipeline p = ...; |
| |
| // A simple Read of a local file (only runs locally): |
| PCollection<String> lines = p.apply(TextIO.read().from("/local/path/to/file.txt")); |
| </code></pre> |
| |
| <p>Example 2: reading a PCollection of filenames. |
| |
| <pre><code> |
| Pipeline p = ...; |
| |
| // E.g. the filenames might be computed from other data in the pipeline, or |
| // read from a data source. |
| PCollection<String> filenames = ...; |
| |
| // Read all files in the collection. |
| PCollection<String> lines = filenames.apply(TextIO.readAll()); |
| </code></pre> |
| |
| <p>Example 3: streaming new files matching a filepattern. |
| |
| <pre><code> |
| Pipeline p = ...; |
| |
| PCollection<String> lines = p.apply(TextIO.read() |
| .from("/local/path/to/files/*") |
| .watchForNewFiles( |
| // Check for new files every minute |
| Duration.standardMinutes(1), |
| // Stop watching the filepattern if no new files appear within an hour |
| afterTimeSinceNewOutput(Duration.standardHours(1)))); |
| </code></pre> |
| |
| <h3>Reading a very large number of files</h3> |
| |
| <p>If it is known that the filepattern will match a very large number of files (e.g. tens of |
| thousands or more), use <a href="../../../../../org/apache/beam/sdk/io/TextIO.Read.html#withHintMatchesManyFiles--"><code>TextIO.Read.withHintMatchesManyFiles()</code></a> for better performance and |
| scalability. Note that it may decrease performance if the filepattern matches only a small number |
| of files. |
| |
| <h2>Writing text files</h2> |
| |
| <p>To write a <a href="../../../../../org/apache/beam/sdk/values/PCollection.html" title="class in org.apache.beam.sdk.values"><code>PCollection</code></a> to one or more text files, use <code>TextIO.write()</code>, using |
| <a href="../../../../../org/apache/beam/sdk/io/TextIO.Write.html#to-java.lang.String-"><code>TextIO.Write.to(String)</code></a> to specify the output prefix of the files to write. |
| |
| <p>For example: |
| |
| <pre><code> |
| // A simple Write to a local file (only runs locally): |
| PCollection<String> lines = ...; |
| lines.apply(TextIO.write().to("/path/to/file.txt")); |
| |
| // Same as above, only with Gzip compression: |
| PCollection<String> lines = ...; |
| lines.apply(TextIO.write().to("/path/to/file.txt")) |
| .withSuffix(".txt") |
| .withCompression(Compression.GZIP)); |
| </code></pre> |
| |
| <p>Any existing files with the same names as generated output files will be overwritten. |
| |
| <p>If you want better control over how filenames are generated than the default policy allows, a |
| custom <a href="../../../../../org/apache/beam/sdk/io/FileBasedSink.FilenamePolicy.html" title="class in org.apache.beam.sdk.io"><code>FileBasedSink.FilenamePolicy</code></a> can also be set using <code>TextIO.Write#to(FilenamePolicy)</code>. |
| |
| <h3>Advanced features</h3> |
| |
| <p><a href="../../../../../org/apache/beam/sdk/io/TextIO.html" title="class in org.apache.beam.sdk.io"><code>TextIO</code></a> supports all features of <a href="../../../../../org/apache/beam/sdk/io/FileIO.html#write--"><code>FileIO.write()</code></a> and <a href="../../../../../org/apache/beam/sdk/io/FileIO.html#writeDynamic--"><code>FileIO.writeDynamic()</code></a>, |
| such as writing windowed/unbounded data, writing data to multiple destinations, and so on, by |
| providing a <a href="../../../../../org/apache/beam/sdk/io/TextIO.Sink.html" title="class in org.apache.beam.sdk.io"><code>TextIO.Sink</code></a> via <a href="../../../../../org/apache/beam/sdk/io/TextIO.html#sink--"><code>sink()</code></a>. |
| |
| <p>For example, to write events of different type to different filenames: |
| |
| <pre><code> |
| PCollection<Event> events = ...; |
| events.apply(FileIO.<EventType, Event>writeDynamic() |
| .by(Event::getTypeName) |
| .via(TextIO.sink(), Event::toString) |
| .to(type -> nameFilesUsingWindowPaneAndShard(".../events/" + type + "/data", ".txt"))); |
| </code></pre> |
| |
| <p>For backwards compatibility, <a href="../../../../../org/apache/beam/sdk/io/TextIO.html" title="class in org.apache.beam.sdk.io"><code>TextIO</code></a> also supports the legacy <a href="../../../../../org/apache/beam/sdk/io/FileBasedSink.DynamicDestinations.html" title="class in org.apache.beam.sdk.io"><code>FileBasedSink.DynamicDestinations</code></a> interface for advanced features via <code>Write#to(DynamicDestinations)</code>.</div> |
| </li> |
| </ul> |
| </div> |
| <div class="summary"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- ======== NESTED CLASS SUMMARY ======== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="nested.class.summary"> |
| <!-- --> |
| </a> |
| <h3>Nested Class Summary</h3> |
| <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Nested Class Summary table, listing nested classes, and an explanation"> |
| <caption><span>Nested Classes</span><span class="tabEnd"> </span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Modifier and Type</th> |
| <th class="colLast" scope="col">Class and Description</th> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>static class </code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/beam/sdk/io/TextIO.CompressionType.html" title="enum in org.apache.beam.sdk.io">TextIO.CompressionType</a></span></code> |
| <div class="block"><span class="deprecatedLabel">Deprecated.</span> |
| <div class="block"><span class="deprecationComment">Use <a href="../../../../../org/apache/beam/sdk/io/Compression.html" title="enum in org.apache.beam.sdk.io"><code>Compression</code></a>.</span></div> |
| </div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code>static class </code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/beam/sdk/io/TextIO.Read.html" title="class in org.apache.beam.sdk.io">TextIO.Read</a></span></code> |
| <div class="block">Implementation of <a href="../../../../../org/apache/beam/sdk/io/TextIO.html#read--"><code>read()</code></a>.</div> |
| </td> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>static class </code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/beam/sdk/io/TextIO.ReadAll.html" title="class in org.apache.beam.sdk.io">TextIO.ReadAll</a></span></code> |
| <div class="block">Implementation of <a href="../../../../../org/apache/beam/sdk/io/TextIO.html#readAll--"><code>readAll()</code></a>.</div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code>static class </code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/beam/sdk/io/TextIO.ReadFiles.html" title="class in org.apache.beam.sdk.io">TextIO.ReadFiles</a></span></code> |
| <div class="block">Implementation of <a href="../../../../../org/apache/beam/sdk/io/TextIO.html#readFiles--"><code>readFiles()</code></a>.</div> |
| </td> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>static class </code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/beam/sdk/io/TextIO.Sink.html" title="class in org.apache.beam.sdk.io">TextIO.Sink</a></span></code> |
| <div class="block">Implementation of <a href="../../../../../org/apache/beam/sdk/io/TextIO.html#sink--"><code>sink()</code></a>.</div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code>static class </code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/beam/sdk/io/TextIO.TypedWrite.html" title="class in org.apache.beam.sdk.io">TextIO.TypedWrite</a><<a href="../../../../../org/apache/beam/sdk/io/TextIO.TypedWrite.html" title="type parameter in TextIO.TypedWrite">UserT</a>,<a href="../../../../../org/apache/beam/sdk/io/TextIO.TypedWrite.html" title="type parameter in TextIO.TypedWrite">DestinationT</a>></span></code> |
| <div class="block">Implementation of <a href="../../../../../org/apache/beam/sdk/io/TextIO.html#write--"><code>write()</code></a>.</div> |
| </td> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>static class </code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/beam/sdk/io/TextIO.Write.html" title="class in org.apache.beam.sdk.io">TextIO.Write</a></span></code> |
| <div class="block">This class is used as the default return value of <a href="../../../../../org/apache/beam/sdk/io/TextIO.html#write--"><code>write()</code></a>.</div> |
| </td> |
| </tr> |
| </table> |
| </li> |
| </ul> |
| <!-- ========== METHOD SUMMARY =========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="method.summary"> |
| <!-- --> |
| </a> |
| <h3>Method Summary</h3> |
| <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation"> |
| <caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd"> </span></span><span id="t1" class="tableTab"><span><a href="javascript:show(1);">Static Methods</a></span><span class="tabEnd"> </span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd"> </span></span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Modifier and Type</th> |
| <th class="colLast" scope="col">Method and Description</th> |
| </tr> |
| <tr id="i0" class="altColor"> |
| <td class="colFirst"><code>static <a href="../../../../../org/apache/beam/sdk/io/TextIO.Read.html" title="class in org.apache.beam.sdk.io">TextIO.Read</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/beam/sdk/io/TextIO.html#read--">read</a></span>()</code> |
| <div class="block">A <a href="../../../../../org/apache/beam/sdk/transforms/PTransform.html" title="class in org.apache.beam.sdk.transforms"><code>PTransform</code></a> that reads from one or more text files and returns a bounded <a href="../../../../../org/apache/beam/sdk/values/PCollection.html" title="class in org.apache.beam.sdk.values"><code>PCollection</code></a> containing one element for each line of the input files.</div> |
| </td> |
| </tr> |
| <tr id="i1" class="rowColor"> |
| <td class="colFirst"><code>static <a href="../../../../../org/apache/beam/sdk/io/TextIO.ReadAll.html" title="class in org.apache.beam.sdk.io">TextIO.ReadAll</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/beam/sdk/io/TextIO.html#readAll--">readAll</a></span>()</code> |
| <div class="block">A <a href="../../../../../org/apache/beam/sdk/transforms/PTransform.html" title="class in org.apache.beam.sdk.transforms"><code>PTransform</code></a> that works like <a href="../../../../../org/apache/beam/sdk/io/TextIO.html#read--"><code>read()</code></a>, but reads each file in a <a href="../../../../../org/apache/beam/sdk/values/PCollection.html" title="class in org.apache.beam.sdk.values"><code>PCollection</code></a> of filepatterns.</div> |
| </td> |
| </tr> |
| <tr id="i2" class="altColor"> |
| <td class="colFirst"><code>static <a href="../../../../../org/apache/beam/sdk/io/TextIO.ReadFiles.html" title="class in org.apache.beam.sdk.io">TextIO.ReadFiles</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/beam/sdk/io/TextIO.html#readFiles--">readFiles</a></span>()</code> |
| <div class="block">Like <a href="../../../../../org/apache/beam/sdk/io/TextIO.html#read--"><code>read()</code></a>, but reads each file in a <a href="../../../../../org/apache/beam/sdk/values/PCollection.html" title="class in org.apache.beam.sdk.values"><code>PCollection</code></a> of <a href="../../../../../org/apache/beam/sdk/io/FileIO.ReadableFile.html" title="class in org.apache.beam.sdk.io"><code>FileIO.ReadableFile</code></a>, returned by <a href="../../../../../org/apache/beam/sdk/io/FileIO.html#readMatches--"><code>FileIO.readMatches()</code></a>.</div> |
| </td> |
| </tr> |
| <tr id="i3" class="rowColor"> |
| <td class="colFirst"><code>static <a href="../../../../../org/apache/beam/sdk/io/TextIO.Sink.html" title="class in org.apache.beam.sdk.io">TextIO.Sink</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/beam/sdk/io/TextIO.html#sink--">sink</a></span>()</code> |
| <div class="block">Creates a <a href="../../../../../org/apache/beam/sdk/io/TextIO.Sink.html" title="class in org.apache.beam.sdk.io"><code>TextIO.Sink</code></a> that writes newline-delimited strings in UTF-8, for use with <a href="../../../../../org/apache/beam/sdk/io/FileIO.html#write--"><code>FileIO.write()</code></a>.</div> |
| </td> |
| </tr> |
| <tr id="i4" class="altColor"> |
| <td class="colFirst"><code>static <a href="../../../../../org/apache/beam/sdk/io/TextIO.Write.html" title="class in org.apache.beam.sdk.io">TextIO.Write</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/beam/sdk/io/TextIO.html#write--">write</a></span>()</code> |
| <div class="block">A <a href="../../../../../org/apache/beam/sdk/transforms/PTransform.html" title="class in org.apache.beam.sdk.transforms"><code>PTransform</code></a> that writes a <a href="../../../../../org/apache/beam/sdk/values/PCollection.html" title="class in org.apache.beam.sdk.values"><code>PCollection</code></a> to a text file (or multiple text files |
| matching a sharding pattern), with each element of the input collection encoded into its own |
| line.</div> |
| </td> |
| </tr> |
| <tr id="i5" class="rowColor"> |
| <td class="colFirst"><code>static <UserT> <a href="../../../../../org/apache/beam/sdk/io/TextIO.TypedWrite.html" title="class in org.apache.beam.sdk.io">TextIO.TypedWrite</a><UserT,java.lang.Void></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/beam/sdk/io/TextIO.html#writeCustomType--">writeCustomType</a></span>()</code> |
| <div class="block">A <a href="../../../../../org/apache/beam/sdk/transforms/PTransform.html" title="class in org.apache.beam.sdk.transforms"><code>PTransform</code></a> that writes a <a href="../../../../../org/apache/beam/sdk/values/PCollection.html" title="class in org.apache.beam.sdk.values"><code>PCollection</code></a> to a text file (or multiple text files |
| matching a sharding pattern), with each element of the input collection encoded into its own |
| line.</div> |
| </td> |
| </tr> |
| </table> |
| <ul class="blockList"> |
| <li class="blockList"><a name="methods.inherited.from.class.java.lang.Object"> |
| <!-- --> |
| </a> |
| <h3>Methods inherited from class java.lang.Object</h3> |
| <code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </div> |
| <div class="details"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- ============ METHOD DETAIL ========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="method.detail"> |
| <!-- --> |
| </a> |
| <h3>Method Detail</h3> |
| <a name="read--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>read</h4> |
| <pre>public static <a href="../../../../../org/apache/beam/sdk/io/TextIO.Read.html" title="class in org.apache.beam.sdk.io">TextIO.Read</a> read()</pre> |
| <div class="block">A <a href="../../../../../org/apache/beam/sdk/transforms/PTransform.html" title="class in org.apache.beam.sdk.transforms"><code>PTransform</code></a> that reads from one or more text files and returns a bounded <a href="../../../../../org/apache/beam/sdk/values/PCollection.html" title="class in org.apache.beam.sdk.values"><code>PCollection</code></a> containing one element for each line of the input files.</div> |
| </li> |
| </ul> |
| <a name="readAll--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>readAll</h4> |
| <pre>public static <a href="../../../../../org/apache/beam/sdk/io/TextIO.ReadAll.html" title="class in org.apache.beam.sdk.io">TextIO.ReadAll</a> readAll()</pre> |
| <div class="block">A <a href="../../../../../org/apache/beam/sdk/transforms/PTransform.html" title="class in org.apache.beam.sdk.transforms"><code>PTransform</code></a> that works like <a href="../../../../../org/apache/beam/sdk/io/TextIO.html#read--"><code>read()</code></a>, but reads each file in a <a href="../../../../../org/apache/beam/sdk/values/PCollection.html" title="class in org.apache.beam.sdk.values"><code>PCollection</code></a> of filepatterns. |
| |
| <p>Can be applied to both bounded and unbounded <a href="../../../../../org/apache/beam/sdk/values/PCollection.html" title="class in org.apache.beam.sdk.values"><code>PCollections</code></a>, so this is |
| suitable for reading a <a href="../../../../../org/apache/beam/sdk/values/PCollection.html" title="class in org.apache.beam.sdk.values"><code>PCollection</code></a> of filepatterns arriving as a stream. However, every |
| filepattern is expanded once at the moment it is processed, rather than watched for new files |
| matching the filepattern to appear. Likewise, every file is read once, rather than watched for |
| new entries.</div> |
| </li> |
| </ul> |
| <a name="readFiles--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>readFiles</h4> |
| <pre>public static <a href="../../../../../org/apache/beam/sdk/io/TextIO.ReadFiles.html" title="class in org.apache.beam.sdk.io">TextIO.ReadFiles</a> readFiles()</pre> |
| <div class="block">Like <a href="../../../../../org/apache/beam/sdk/io/TextIO.html#read--"><code>read()</code></a>, but reads each file in a <a href="../../../../../org/apache/beam/sdk/values/PCollection.html" title="class in org.apache.beam.sdk.values"><code>PCollection</code></a> of <a href="../../../../../org/apache/beam/sdk/io/FileIO.ReadableFile.html" title="class in org.apache.beam.sdk.io"><code>FileIO.ReadableFile</code></a>, returned by <a href="../../../../../org/apache/beam/sdk/io/FileIO.html#readMatches--"><code>FileIO.readMatches()</code></a>.</div> |
| </li> |
| </ul> |
| <a name="write--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>write</h4> |
| <pre>public static <a href="../../../../../org/apache/beam/sdk/io/TextIO.Write.html" title="class in org.apache.beam.sdk.io">TextIO.Write</a> write()</pre> |
| <div class="block">A <a href="../../../../../org/apache/beam/sdk/transforms/PTransform.html" title="class in org.apache.beam.sdk.transforms"><code>PTransform</code></a> that writes a <a href="../../../../../org/apache/beam/sdk/values/PCollection.html" title="class in org.apache.beam.sdk.values"><code>PCollection</code></a> to a text file (or multiple text files |
| matching a sharding pattern), with each element of the input collection encoded into its own |
| line.</div> |
| </li> |
| </ul> |
| <a name="writeCustomType--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>writeCustomType</h4> |
| <pre>public static <UserT> <a href="../../../../../org/apache/beam/sdk/io/TextIO.TypedWrite.html" title="class in org.apache.beam.sdk.io">TextIO.TypedWrite</a><UserT,java.lang.Void> writeCustomType()</pre> |
| <div class="block">A <a href="../../../../../org/apache/beam/sdk/transforms/PTransform.html" title="class in org.apache.beam.sdk.transforms"><code>PTransform</code></a> that writes a <a href="../../../../../org/apache/beam/sdk/values/PCollection.html" title="class in org.apache.beam.sdk.values"><code>PCollection</code></a> to a text file (or multiple text files |
| matching a sharding pattern), with each element of the input collection encoded into its own |
| line. |
| |
| <p>This version allows you to apply <a href="../../../../../org/apache/beam/sdk/io/TextIO.html" title="class in org.apache.beam.sdk.io"><code>TextIO</code></a> writes to a PCollection of a custom type |
| <code>UserT</code>. A format mechanism that converts the input type <code>UserT</code> to the String that |
| will be written to the file must be specified. If using a custom <a href="../../../../../org/apache/beam/sdk/io/FileBasedSink.DynamicDestinations.html" title="class in org.apache.beam.sdk.io"><code>FileBasedSink.DynamicDestinations</code></a> |
| object this is done using <a href="../../../../../org/apache/beam/sdk/io/FileBasedSink.DynamicDestinations.html#formatRecord-UserT-"><code>FileBasedSink.DynamicDestinations.formatRecord(UserT)</code></a>, otherwise the <a href="../../../../../org/apache/beam/sdk/io/TextIO.TypedWrite.html#withFormatFunction-org.apache.beam.sdk.transforms.SerializableFunction-"><code>TextIO.TypedWrite.withFormatFunction(org.apache.beam.sdk.transforms.SerializableFunction<UserT, java.lang.String>)</code></a> can be used to specify a format function. |
| |
| <p>The advantage of using a custom type is that is it allows a user-provided <a href="../../../../../org/apache/beam/sdk/io/FileBasedSink.DynamicDestinations.html" title="class in org.apache.beam.sdk.io"><code>FileBasedSink.DynamicDestinations</code></a> object, set via <code>Write#to(DynamicDestinations)</code> to examine the |
| custom type when choosing a destination.</div> |
| </li> |
| </ul> |
| <a name="sink--"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>sink</h4> |
| <pre>public static <a href="../../../../../org/apache/beam/sdk/io/TextIO.Sink.html" title="class in org.apache.beam.sdk.io">TextIO.Sink</a> sink()</pre> |
| <div class="block">Creates a <a href="../../../../../org/apache/beam/sdk/io/TextIO.Sink.html" title="class in org.apache.beam.sdk.io"><code>TextIO.Sink</code></a> that writes newline-delimited strings in UTF-8, for use with <a href="../../../../../org/apache/beam/sdk/io/FileIO.html#write--"><code>FileIO.write()</code></a>.</div> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </div> |
| </div> |
| <!-- ========= END OF CLASS DATA ========= --> |
| <!-- ======= START OF BOTTOM NAVBAR ====== --> |
| <div class="bottomNav"><a name="navbar.bottom"> |
| <!-- --> |
| </a> |
| <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> |
| <a name="navbar.bottom.firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../../../../overview-summary.html">Overview</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="navBarCell1Rev">Class</li> |
| <li><a href="package-tree.html">Tree</a></li> |
| <li><a href="../../../../../deprecated-list.html">Deprecated</a></li> |
| <li><a href="../../../../../index-all.html">Index</a></li> |
| <li><a href="../../../../../help-doc.html">Help</a></li> |
| </ul> |
| </div> |
| <div class="subNav"> |
| <ul class="navList"> |
| <li><a href="../../../../../org/apache/beam/sdk/io/Source.Reader.html" title="class in org.apache.beam.sdk.io"><span class="typeNameLink">Prev Class</span></a></li> |
| <li><a href="../../../../../org/apache/beam/sdk/io/TextIO.CompressionType.html" title="enum in org.apache.beam.sdk.io"><span class="typeNameLink">Next Class</span></a></li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="../../../../../index.html?org/apache/beam/sdk/io/TextIO.html" target="_top">Frames</a></li> |
| <li><a href="TextIO.html" target="_top">No Frames</a></li> |
| </ul> |
| <ul class="navList" id="allclasses_navbar_bottom"> |
| <li><a href="../../../../../allclasses-noframe.html">All Classes</a></li> |
| </ul> |
| <div> |
| <script type="text/javascript"><!-- |
| allClassesLink = document.getElementById("allclasses_navbar_bottom"); |
| if(window==top) { |
| allClassesLink.style.display = "block"; |
| } |
| else { |
| allClassesLink.style.display = "none"; |
| } |
| //--> |
| </script> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li><a href="#nested.class.summary">Nested</a> | </li> |
| <li>Field | </li> |
| <li>Constr | </li> |
| <li><a href="#method.summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li>Field | </li> |
| <li>Constr | </li> |
| <li><a href="#method.detail">Method</a></li> |
| </ul> |
| </div> |
| <a name="skip.navbar.bottom"> |
| <!-- --> |
| </a></div> |
| <!-- ======== END OF BOTTOM NAVBAR ======= --> |
| </body> |
| </html> |