Plaster
New
List
Login
text
apl
aspx
asterisk
brainfuck
c
c++hdr
c++src
cassandra
ceylon
clojure
clojurescript
cmake
cobol
coffeescript
common-lisp
crystal
csharp
css
cypher-query
cython
d
dart
diff
django
dockerfile
dylan
ebnf
ecl
ecmascript
edn
eiffel
ejs
elm
erb
erlang
ez80
factor
fcl
feature
forth
fortran
fragment
gfm
go
gql
groovy
gss
haml
handlebars-template
haskell
haxe
hive
html
http
httpd-php
httpd-php-open
hxml
ini
java
javascript
json
jsp
jsx
julia
kotlin
latex
less
literate-haskell
lua
mariadb
markdown
mbox
mirc
mscgen
msgenny
mssql
mumps
mysql
n-triples
nesc
nginx-conf
nsis
objectivec
octave
oz
pascal
perl
pgp
pgp-keys
pgp-signature
pgsql
php
pig
plsql
properties
protobuf
puppet
python
q
rpm-changes
rpm-spec
rsrc
ruby
rustsrc
sas
sass
scala
scheme
scss
sieve
slim
smarty
solr
soy
sparql-query
spreadsheet
sql
squirrel
stex
styl
swift
systemverilog
tcl
textile
tiddlywiki
tiki
tlv
tornado
ttcn-asn
ttcn-cfg
turtle
twig
typescript
typescript-jsx
vb
vbscript
velocity
verilog
vertex
vhdl
vue
webidl
xml
xml-dtd
xquery
xu
yaml
z80
default
Visibility:
public
unlisted
private
(defclass offset-stream (trivial-gray-streams:fundamental-binary-input-stream) ((%stream :initarg :stream :accessor offset-stream-stream) (%offset :initarg :offset :accessor offset-stream-offset) (%length :initarg :length :accessor offset-stream-length) (%counter :initform 0 :accessor offset-stream-counter)) (:default-initargs :stream (alexandria:required-argument :stream) :offset 0 :length most-positive-fixnum)) (defmethod initialize-instance :after ((object offset-stream) &key stream offset) (file-position stream offset)) (defmethod trivial-gray-streams:stream-read-byte ((stream offset-stream)) (if (<= (offset-stream-length stream) (offset-stream-counter stream)) :eof (prog1 (read-byte (offset-stream-stream stream) nil :eof) (incf (offset-stream-counter stream))))) (defmethod trivial-gray-streams:stream-read-sequence ((stream offset-stream) sequence start end &key) (let* ((maximum (- (offset-stream-length stream) (offset-stream-counter stream))) (new-end (if end (min end maximum) nil))) (read-sequence sequence (offset-stream-stream stream) :start (or start 0) :end new-end))) (defmethod trivial-gray-streams:stream-listen ((stream offset-stream)) (listen (offset-stream-stream stream))) (defmethod close ((stream offset-stream) &key abort) (close (offset-stream-stream stream) abort)) (defmethod open-stream-p ((stream offset-stream)) (open-stream-p (offset-stream-stream stream))) (defmethod stream-element-type ((stream offset-stream)) (stream-element-type (offset-stream-stream stream))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; CL-USER> (alexandria:write-byte-vector-into-file (coerce #(0 1 2 3 4 5 6 7 8 9) '(vector (unsigned-byte 8))) #p"/tmp/bytes") #(0 1 2 3 4 5 6 7 8 9) CL-USER> (with-open-file (stream #p"/tmp/bytes" :element-type '(unsigned-byte 8) :direction :input) (let ((offset-stream (make-instance 'offset-stream :stream stream :length 4 :offset 2)) (output (make-array 10 :initial-element 0))) (read-sequence output offset-stream) output)) #(2 3 4 5 0 0 0 0 0 0)