JuliaIO / BufferedStreams.jl

Fast composable IO streams
MIT License
42 stars 20 forks source link

BufferedStreams doesn't work with ZipFile.jl #58

Open xiaodaigh opened 5 years ago

xiaodaigh commented 5 years ago

Expected Behavior

Expected it to work with ZipFile.jl which is using an io stream

Current Behavior

Errors

Possible Solution / Implementation

Implement the seekend method

Steps to Reproduce (for bugs)

using ZipFile, CSV, DataFrames, BufferedStreams

a = DataFrame(a = 1:3)
CSV.write("c:/data/a.csv", a)

# zip the file; Windows users who do not have zip available on the PATH can manual zip the CSV
;zip c:/data/a.zip c:/data/a.csv

io = BufferedInputStream(open("c:/data/a.zip", "r"))
z = ZipFile.Reader(io)

df = CSV.read(z.files[1])
close(io)

I get this errro

ERROR: MethodError: no method matching seekend(::BufferedInputStream{IOStream})
Closest candidates are:
  seekend(::Base.SecretBuffer) at secretbuffer.jl:150
  seekend(::Base.Filesystem.File) at filesystem.jl:227
  seekend(::IOStream) at iostream.jl:141
  ...

Context

Trying to use BufferedStreams in the context of reading from ZipFiles uisng ZipFile.jl

Your Environment

Julia 1.3-rc1 Windows 10 ZipFile v0.8.3 BufferedStreams v1.0.0

[69666777] Arrow v0.2.3 [c52e3926] Atom v0.10.1 [39de3d68] AxisArrays v0.3.3 [fbb218c0] BSON v0.2.3 [6e4b80f9] BenchmarkTools v0.4.3 [9e28174c] BinDeps v0.8.10 [b99e7846] BinaryProvider v0.5.6 [163b9779] Blobs v0.3.0 [a74b3585] Blosc v0.5.1 [5f4fecfd] BrowseTables v0.3.0 [e1450e63] BufferedStreams v1.0.0 [336ed68f] CSV v0.5.11 [C:\Users\RTX2080\.julia\dev\CSV] [324d7699] CategoricalArrays v0.5.5 [aaaa29a8] Clustering v0.13.3 [944b1d66] CodecZlib v0.6.0 [34da2185] Compat v2.1.0 [3a865a2d] CuArrays v1.2.1 [d58978e5] Dagger v0.8.0 [9a962f9c] DataAPI v1.0.1 [a93c6f00] DataFrames v0.19.4 [1313f7d8] DataFramesMeta v0.5.0 [864edb3b] DataStructures v0.17.0 [e7dc6d0d] DataValues v0.4.12 [31a5f54b] Debugger v0.6.1 [7806a523] DecisionTree v0.8.3 [b4f34e82] Distances v0.8.2 [31c24e10] Distributions v0.21.1 [becb17da] Feather v0.5.3 [5789e2e9] FileIO v1.0.7 [53afe959] FlatBuffers v0.5.3 [587475ba] Flux v0.9.0 [01a6e8c0] FstFileFormat v0.1.0 [38e38edf] GLM v1.3.1 [28b8d3ca] GR v0.41.0 [4d00f742] GeometryTypes v0.7.6 [708ec375] Gumbo v0.5.1 [cd3eb016] HTTP v0.8.6 [7073ff75] IJulia v1.20.0 [6218d12a] ImageMagick v0.7.5 [916415d5] Images v0.18.0 [5903a43b] Infiltrator v0.1.0 [C:\Users\RTX2080\.julia\dev\Infiltrator] [7d512f48] InternedStrings v0.7.0 [41ab1584] InvertedIndices v1.0.0 [82899510] IteratorInterfaceExtensions v1.0.0 [babc3d20] JDF v0.1.0 [c:/Users/RTX2080\\git\\JDF\\] [9da8a3cd] JLSO v1.1.0 [e5e0dc1b] Juno v0.7.2 [b964fa9f] LaTeXStrings v1.0.3 [50d2b5c4] Lazy v0.14.0 [add582a8] MLJ v0.2.3 [f28f55f0] Memento v0.12.1 [e1d29d7a] Missings v0.4.2 [9b87118b] PackageCompiler v0.6.4+ #sd-notomls (https://github.com/JuliaLang/PackageCompiler.jl.git) [d96e819e] Parameters v0.11.0 [626c502c] Parquet v0.3.0 [91a5bcdd] Plots v0.26.3 [2dfb63ee] PooledArrays v0.5.2 [08abe8d2] PrettyTables v0.5.1 [6f49c342] RCall v0.13.4 [ce6b1742] RDatasets v0.6.1 [17b45ede] RLEVectors v0.8.1 [189a3867] Reexport v0.2.0 [295af30f] Revise v2.1.10 [6e75b9c4] ScikitLearnBase v0.5.0 [a2af1166] SortingAlgorithms v0.3.1 [2913bbd2] StatsBase v0.32.0 [c:/git/StatsBase.jl] [f3b207a7] StatsPlots v0.12.0 [fd094767] Suppressor v0.1.1 [70df011a] TableReader v0.4.0 [3783bdb8] TableTraits v1.0.0 [40c74d1a] TableView v0.4.1 [bd369af6] Tables v0.2.11 [f269a46b] TimeZones v0.9.2 [9f7883ad] Tracker v0.2.3 [3bb67fe8] TranscodingStreams v0.9.5 [b8865327] UnicodePlots v1.1.0 [34922c18] VisualRegressionTests v0.3.1 [ea10d353] WeakRefStrings v0.6.1 [a5390f91] ZipFile v0.8.3 [ade2ca70] Dates [8bb1440f] DelimitedFiles [37e2e46d] LinearAlgebra [44cfe95a] Pkg [de0858da] Printf [3fa0cd96] REPL [9a3f8284] Random [2f01184e] SparseArrays [10745b16] Statistics [8dfed614] Test [4ec0a83e] Unicode