libBigWig
io.h
Go to the documentation of this file.
1 #include <curl/curl.h>
9 extern size_t GLOBAL_DEFAULTBUFFERSIZE;
10 
15  BWG_FILE = 0,
16  BWG_HTTP = 1,
17  BWG_HTTPS = 2,
18  BWG_FTP = 3
19 };
20 
24 typedef struct {
25  union {
26  CURL *curl;
27  FILE *fp;
28  } x;
29  void *memBuf;
30  size_t filePos;
31  size_t bufPos;
32  size_t bufSize;
33  size_t bufLen;
35  char *fname;
36 } URL_t;
37 
51 size_t urlRead(URL_t *URL, void *buf, size_t bufSize);
52 
63 CURLcode urlSeek(URL_t *URL, size_t pos);
64 
80 URL_t *urlOpen(char *fname, CURLcode (*callBack)(CURL*), const char* mode);
81 
91 void urlClose(URL_t *URL);
This structure holds the file pointers and buffers needed for raw access to local and remote files...
Definition: io.h:24
FILE * fp
Definition: io.h:27
void urlClose(URL_t *URL)
Close a local/remote file.
Definition: io.c:239
size_t bufPos
Definition: io.h:31
size_t bufSize
Definition: io.h:32
size_t filePos
Definition: io.h:30
size_t bufLen
Definition: io.h:33
CURLcode urlSeek(URL_t *URL, size_t pos)
Seeks to a given position in a local or remote file.
Definition: io.c:104
char * fname
Definition: io.h:35
bigWigFile_type_enum
Definition: io.h:14
void * memBuf
Definition: io.h:29
size_t GLOBAL_DEFAULTBUFFERSIZE
Definition: io.c:9
URL_t * urlOpen(char *fname, CURLcode(*callBack)(CURL *), const char *mode)
Open a local or remote file.
Definition: io.c:139
CURL * curl
Definition: io.h:26
size_t urlRead(URL_t *URL, void *buf, size_t bufSize)
Reads data into the given buffer.
Definition: io.c:77