1
0
mirror of https://github.com/danog/byte-stream.git synced 2024-12-11 17:09:43 +01:00
Commit Graph

143 Commits

Author SHA1 Message Date
Bob Weinand
666ece18a4 Fix invalid StreamException upon full write buffer
And add a few tests with chunk size writes
2017-07-15 10:06:12 +02:00
Niklas Keller
4777508637 Fail streaming messages correctly on read failures
Fixes #18.
2017-06-28 11:35:12 +02:00
Niklas Keller
704adf70cf Add reference and unreference methods to ResourceInputStream 2017-06-23 16:33:13 +02:00
Niklas Keller
b67358ad91 Suppress errors on close for resource streams
A resource might still be non-null, but already closed.
2017-06-19 08:43:07 +02:00
Aaron Piotrowski
48c4e122d8
Tweak closing
Resource is not nulled in watcher callback if reading/writing fails so close() will still call shutdown/fclose.
2017-06-18 23:14:59 -05:00
Niklas Keller
8d74c85048 Apply same closing mechanism to RIS 2017-06-18 23:25:22 +02:00
Niklas Keller
798723e942 Use \fclose for unidirectional resources to cover pipes 2017-06-18 22:57:19 +02:00
Niklas Keller
93540890fd Remove unnecessary isset check for stream modes 2017-06-18 22:55:44 +02:00
Niklas Keller
161c73471d stream_socket_shutdown resources in ROS on close 2017-06-18 20:16:05 +02:00
Aaron Piotrowski
816307c665 Fix writing in watcher callback if $chunkSize is null 2017-06-18 11:47:58 -05:00
Niklas Keller
8b20bf90b8 Fix feof check 2017-06-17 17:46:18 +02:00
Niklas Keller
0071609904 Fix minor phpdoc issue 2017-06-17 17:10:23 +02:00
Aaron Piotrowski
7a8d6d5f1f Remove Parser
Moved to a separate repository at amphp/parser.
2017-06-07 22:23:44 -05:00
Niklas Keller
6eb83c1218 Make Parser methods instead of class final 2017-06-05 14:54:51 +02:00
Niklas Keller
06715d6387 Revert "Fixup 7543f30fd66e41315677e1800082ba8b79f60b4c"
This reverts commit 751b757ae2.
2017-06-05 13:39:07 +02:00
Niklas Keller
751b757ae2 Fixup 7543f30fd6 2017-06-05 13:36:29 +02:00
Niklas Keller
c87c0cca98 Remove wrong return type from Parser::push 2017-06-04 11:41:44 +02:00
Niklas Keller
51265e4ece Remove OutputStream from Parser, make it not implementing the interface 2017-06-04 11:40:15 +02:00
Aaron Piotrowski
7543f30fd6 Do not include delimiter in sent string 2017-06-01 00:08:18 -05:00
Aaron Piotrowski
b5d2a8d434 Do not send remaining buffer on end 2017-05-31 23:51:44 -05:00
Aaron Piotrowski
06fc788d32 Revert "Add Parser::getBuffer()"
This reverts commit 253aaaf4fa.
2017-05-29 23:29:19 -05:00
Niklas Keller
ea135f26d0 Fix chunk size issue in ResourceOutputStream, fixes #14 2017-05-29 17:34:29 +02:00
Niklas Keller
2ecbf8aa8b Respect chunk size for ResourceOutputStream, document resource streams 2017-05-25 18:12:12 +02:00
Niklas Keller
a27cd0c3db Make ClosedException final 2017-05-25 17:52:07 +02:00
Niklas Keller
2bf2f8af06 Document compression streams 2017-05-25 17:51:25 +02:00
Niklas Keller
21945b888f Make Parser + PendingReadError final, add explicit note about extension to Message 2017-05-25 17:30:53 +02:00
Niklas Keller
6bc8199340 Drop Buffer as per #13, fixes #13 2017-05-24 18:30:38 +02:00
Niklas Keller
bf1635fa39 Suppress warning for invalid contexts, we throw an exception there 2017-05-22 14:44:36 +02:00
Niklas Keller
eb9394a5da Make resource streams final 2017-05-22 14:38:39 +02:00
Niklas Keller
c33c2bec61 Make InMemoryStream, IteratorStream and methods of Message final 2017-05-22 14:37:20 +02:00
Niklas Keller
7616029740 Allow options for Zlib streams, fixes #10 2017-05-22 14:35:13 +02:00
Niklas Keller
6b369657a1 Reject non-strings in IteratorStream 2017-05-22 10:41:35 +02:00
Niklas Keller
253aaaf4fa Add Parser::getBuffer() 2017-05-22 08:34:38 +02:00
Niklas Keller
9e90d1fa09 Add tests, fix ResourceOutputStream writable check 2017-05-16 23:27:48 +02:00
Niklas Keller
71745c6105 Make Message accept an InputStream instead of an Iterator
The purpose of Message is to allow streaming and buffering of an
InputStream with a simple API. Before this commit, Message served a
second purpose: Converting an Amp\Iterator to an InputStream. This has
been separated to allow ZlibInputStream and other InputStreams to be
used as Message. Converting an Amp\Iterator to an InputStream is now
possible using the new IteratorStream class.
2017-05-14 16:40:42 +02:00
Niklas Keller
c397a22ac9 Rename Gzip*Stream to Zlib*Stream and allow different encodings 2017-05-14 14:40:32 +02:00
Aaron Piotrowski
ca3ab2dc73 Restore destructor on resource stream
Forgot close() needed to be called to free watcher.
2017-05-12 10:27:58 -05:00
Aaron Piotrowski
e7f7326363 PendingReadException → PendingReadError
Consecutive reads is a coding error, so it should be an instance of Error.
2017-05-12 00:06:07 -05:00
Aaron Piotrowski
f6e765cea3 Succeed reads with null on closed stream 2017-05-11 23:56:36 -05:00
Aaron Piotrowski
c2eac67b79 Fix close() and make public again 2017-05-11 23:52:15 -05:00
Aaron Piotrowski
cfbf25e3b5 Remove close() from interfaces 2017-05-11 18:08:45 -05:00
Bob Weinand
98bbffb48f Fix Message::read() when end is reached before call to read() 2017-05-11 16:33:00 +02:00
Aaron Piotrowski
11a92648d1 Revert IteratorStream name to Message 2017-05-10 18:20:34 -05:00
Aaron Piotrowski
abb7c9c6b5 Use back-pressure 2017-05-10 18:04:10 -05:00
Niklas Keller
a66fef9b55 Add InMemoryStream 2017-05-08 11:15:10 +02:00
Niklas Keller
59b2454253 Fix null pointer access in GzipInputStream 2017-05-08 09:44:54 +02:00
Niklas Keller
56ec64c508 Fix null pointer access in GzipOutputStream::close 2017-05-08 09:30:19 +02:00
Niklas Keller
f89c6a1161 Implement GzipOutputStream, closes #5 2017-05-08 08:51:52 +02:00
Niklas Keller
3a51a03d0f Fix code style 2017-05-07 22:19:55 +02:00
Niklas Keller
55a7118da9 Add .editorconfig and fix code style 2017-05-07 22:14:45 +02:00
Aaron Piotrowski
6241988750 Restore Message as IteratorStream 2017-05-07 22:10:16 +02:00
Niklas Keller
23f5ba91b9 Simplify GzipInputStream by removing the state tracking 2017-05-07 11:14:41 +02:00
Niklas Keller
bc24326ec0 Add GzipInputStream 2017-05-05 22:39:39 +02:00
Niklas Keller
9714de66ae Remove buffered stream implementations 2017-05-05 16:47:45 +02:00
Niklas Keller
73e6441fd9 Add getResource() to resource streams 2017-05-05 16:45:53 +02:00
Niklas Keller
622f98c966 Improve readability, written is never larger than length 2017-05-05 15:42:18 +02:00
Aaron Piotrowski
4b7a537d7b Refactor ResourceInputStream for new API 2017-05-04 16:30:40 -05:00
Aaron Piotrowski
f3536494e9 Fix conflicts in Parser 2017-05-04 16:30:13 -05:00
Niklas Keller
bf90335bb6 Major API change + merged Reader and Writer from amphp/socket 2017-04-30 08:33:16 +02:00
Aaron Piotrowski
6d9d3bd8d2 Drop dispose method from Parser
Nulling the generator reference is enough. dispose() was not able to guarantee catching from finally. Just don't throw from finally in a parser generator.
2017-04-27 18:30:27 -05:00
Niklas Keller
16fc80ae3b Update and fix php-cs-fixer and code style 2017-04-26 08:27:52 +02:00
Niklas Keller
9f22953566 Fix typo 2017-04-26 08:21:18 +02:00
Niklas Keller
5ed3a00d33 Fix minor coding issues and typos 2017-04-26 08:17:19 +02:00
Aaron Piotrowski
c331b2138a Add Parser 2017-04-15 09:44:22 -05:00
Aaron Piotrowski
b1c3b9ce96 Update docblock notes 2017-04-14 18:08:31 -05:00
Aaron Piotrowski
5d7d0c97d2 Listener → StreamIterator 2017-04-14 18:06:18 -05:00
Aaron Piotrowski
8d59f8a8b9 Manually count bytes written in pipe()
write() may not resolve with the number of bytes written
2017-04-14 17:52:57 -05:00
Aaron Piotrowski
1d7c9f0d5d Remove MemoryStream 2017-04-14 17:52:28 -05:00
Aaron Piotrowski
b0c9dcf839 wait() → advance() 2017-04-14 17:52:22 -05:00
Aaron Piotrowski
2d83001ca4 Keep string as default type 2017-04-14 09:20:28 -05:00
Aaron Piotrowski
39584ab47e Remove specific success value from write() and end() 2017-04-13 18:14:27 -05:00
Aaron Piotrowski
7cc313a633 Drop extending Promise 2017-04-13 09:04:56 -05:00
Aaron Piotrowski
5e250f7c79 Refactor ReadableStream and Message 2017-04-12 00:43:48 -05:00
Aaron Piotrowski
9ad62cae84 Remove final from Message 2017-04-11 19:17:44 -05:00
Aaron Piotrowski
e0d770ff9a Refactor pipe()
Read in chunks instead of buffering
2017-04-11 19:12:25 -05:00
Aaron Piotrowski
c3dc509e5c Add readAll(); succeed delimiter-based reads on end 2017-04-10 23:58:24 -05:00
Aaron Piotrowski
f358b7a38b Add Message 2017-04-04 11:24:15 -05:00
Aaron Piotrowski
04a74eb31d Remove close() from stream interfaces 2017-04-04 11:19:52 -05:00
Aaron Piotrowski
07bd162882 Resolve unbounded read with empty string 2017-03-29 00:09:34 -05:00
Aaron Piotrowski
d29c100c9c Cleanup exceptions 2017-03-28 23:50:56 -05:00
Aaron Piotrowski
458e4c68fd Add MessageStream
Converts a Message object to a ReadableStream.
2017-03-28 23:45:26 -05:00
Aaron Piotrowski
858a76e675 Split into readable and writable stream 2017-03-23 18:38:15 -05:00
Aaron Piotrowski
4414c6bbe4 Update for async-interop merge and other Amp changes; changed namespace to ByteStream 2017-03-16 16:49:09 -05:00
Aaron Piotrowski
4c5b7f539b Formating fix 2017-01-09 10:53:42 -06:00
Aaron Piotrowski
1a047f3f78 Move internal functions to Internal namespace 2017-01-09 10:53:36 -06:00
Aaron Piotrowski
e72bc00605 Stream → ByteStream
Avoid confusion with Amp\Stream.
2017-01-09 10:52:29 -06:00
Aaron Piotrowski
772a5e3c7a Update for async-interop namespace change 2017-01-09 10:29:08 -06:00
Aaron Piotrowski
e258c7b50d Drop strict types 2016-12-29 23:09:06 -06:00
Aaron Piotrowski
32df68151a Awaitable → Promise 2016-11-14 15:05:19 -06:00
Aaron Piotrowski
6990d8675e Move strict types declaration 2016-08-18 11:00:38 -05:00
Aaron Piotrowski
20c4ddf5a7 Use strict types 2016-08-16 16:23:46 -05:00
Aaron Piotrowski
cbee269f22 PHP 7 only upgrade 2016-08-15 17:19:32 -05:00
Aaron Piotrowski
b1950f87f5 Initial commit 2016-08-10 16:52:25 -05:00