Gets the header read in from the csv file or specified via the CSV specification.

@return The header of the CSV file
349414
public List<String> getHeader() {
      if (header == null) {
         return Collections.emptyList();
      }
      return Collections.unmodifiableList(header);
   }
954605
protected function getFieldHeader()
    {
        # read the input stream until the empty line after the header
        $position = $this->readUntil("\r\n\r\n");

        # separate the header from the field content
        # remove the header content from the buffer
        $header = substr($this->buffer, 0, $position);
        $this->buffer = substr($this->buffer, $position + 4);

        $regex =
            "/content-disposition:[\t ]+?form-data;".
            "[\t ]+(?:name=\"(.*?)\")?".
            "(?:;[\t ]+?filename=\"(.*?)\")?/i";

        if (preg_match($regex, $header, $matches) !== 1) {
            fclose($this->fp);
            throw new \sndsgd\http\data\DecodeException(
                "Invalid multipart data; 'Content-Disposition' ".
                "malformed or missing in file field header"
            );
        }

        # we have no need for the entire match, so we drop it here
        list( , $name, $filename) = array_pad($matches, 3, "");

        # if a filename was in the content disposition
        # attempt to find its content type in the field header
        if ($filename !== "") {
            $regex = "/content-type:[\t ]+?(.*)(?:;|$)/mi";
            if (preg_match($regex, $header, $matches) === 1) {
                $contentType = strtolower($matches[1]);
            } else {
                $contentType = "";
            }
        } else {
            $contentType = "";
        }

        return [$name, $filename, $contentType];
    }
1199608
protected function fetchCSVHeader()
    {
        $srcRow = fgetcsv(
            $this->fileHandle,
            0,
            $this->delimiter,
            $this->enclosure
        );

        $this->headerRow = $this->remapHeader($srcRow);
    }
1112315
public String printHead() throws IOException {
        final ByteArrayOutputStream baos = new ByteArrayOutputStream();
        this.printHead(baos);
        return new Utf8String(baos.toByteArray()).asString();
    }
802801
public static VcfHeader header(final File file) throws IOException {
        checkNotNull(file);
        // could also use Files.asCharSource(file, Charsets.UTF_8).openBufferedStream()
        try (BufferedReader reader = new BufferedReader(new FileReader(file))) {
            return header(reader);
        }
    }
820751
public Header getHeader() {
        List<Header> list = this.getDescendants(Header.class);
        if (list.size() > 0) {
            return list.get(0);
        } else {
            return null;
        }
    }
102332
private String readHeaderString(BufferedInputStream stream) throws IOException
   {
      int bufferSize = 100;
      stream.mark(bufferSize);
      byte[] buffer = new byte[bufferSize];
      stream.read(buffer);
      Charset charset = CharsetHelper.UTF8;
      String header = new String(buffer, charset);
      int prefixIndex = header.indexOf("PPX!!!!|");
      int suffixIndex = header.indexOf("|!!!!XPP");

      if (prefixIndex != 0 || suffixIndex == -1)
      {
         throw new IOException("File format not recognised");
      }

      int skip = suffixIndex + 9;
      stream.reset();
      stream.skip(skip);

      return header.substring(prefixIndex + 8, suffixIndex);
   }
117410
public List<HeaderEntry> getHeaderEntryList() {
    final List<HeaderEntry> list = new ArrayList<>();
    final Iterator it = this.headers.entrySet().iterator();
    while (it.hasNext()) {
      final Map.Entry pair = (Map.Entry)it.next();
      System.out.println(pair.getKey() + " = " + pair.getValue());
      final HeaderEntry e = HeaderEntry.newBuilder()
              .setKey((String) pair.getKey())
              .setValue((String) pair.getValue())
              .build();
      list.add(e);
      it.remove(); // avoids a ConcurrentModificationException
    }
    return list;
  }
1039757
private int get() throws IOException {
        int c = theLookahead;
        theLookahead = EOF;
        if (c == EOF) {
            c = inputStream.read();
        }
        if (c >= ' ' || c == '\n' || c == EOF) {
            return c;
        }
        if (c == '\r') {
            return '\n';
        }
        return ' ';
    }
616160
protected function getFieldHeader()
    {
        # read the input stream until the empty line after the header
        $position = $this->readUntil("\r\n\r\n");

        # separate the header from the field content
        # remove the header content from the buffer
        $header = substr($this->buffer, 0, $position);
        $this->buffer = substr($this->buffer, $position + 4);

        $regex =
            "/content-disposition:[\t ]+?form-data;" .
            "[\t ]+(?:name=\"(.*?)\")?" .
            "(?:;[\t ]+?filename=\"(.*?)\")?/i";

        if (preg_match($regex, $header, $matches) !== 1) {
            fclose($this->fp);
            throw new DecodeException(
                "Invalid multipart data; 'Content-Disposition' " .
                "malformed or missing in file field header"
            );
        }
        # we have no need for the entire match, so we drop it here
        $paddedMatches = array_pad($matches, 3, "");
        $name = $paddedMatches[1];
        $filename = $paddedMatches[2];

        # if a filename was in the content disposition
        # attempt to find its content type in the field header
        if ($filename !== "") {
            $regex = "/content-type:[\t ]+?(.*)(?:;|$)/mi";
            if (preg_match($regex, $header, $matches) === 1) {
                $contentType = strtolower($matches[1]);
            } else {
                $contentType = "";
            }
        } else {
            $contentType = "";
        }

        return [
            'name'        => $name,
            'filename'    => $filename,
            'contentType' => $contentType
        ];
    }
537985
public final String csv() {
        StringBuilder sb = new StringBuilder();
        String header =
                "#RunID, ClientID, MsgCount, MsgBytes, MsgsPerSec, BytesPerSec, DurationSecs";

        sb.append(String.format("%s stats: %s\n", name, this));
        sb.append(header); sb.append("\n");
        sb.append(csvLines(subs,"S"));
        sb.append(csvLines(pubs,"P"));
        return sb.toString();
    }
105331
protected byte[] getHeader() {
        byte[] header = new byte[MINIMUM_PAGE_SIZE + numLVs];
        header[0] = (byte)'O';
        header[1] = (byte)'g';
        header[2] = (byte)'g';
        header[3] = (byte)'S';

        header[4] = 0; // Version

        byte flags = 0;
        if(isContinue) {
            flags += 1;
        }
        if(isBOS) {
            flags += 2;
        }
        if(isEOS) {
            flags += 4;
        }
        header[5] = flags;

        IOUtils.putInt8(header, 6, granulePosition);
        IOUtils.putInt4(header, 14, sid);
        IOUtils.putInt4(header, 18, seqNum);

        // Checksum @ 22 left blank for now

        header[26] = IOUtils.fromInt(numLVs);
        System.arraycopy(lvs, 0, header, MINIMUM_PAGE_SIZE, numLVs);

        return header;
    }
942114
public function getHeader()
    {
        $this->withHeader = true;
        if (ftell($this->handle) == 0) {
            $this->header = $this->read();
        }
        return $this->header;
    }
175189
public function readLine()
    {
        $out = $this->read();
        if ($this->withHeader && is_array($out)) {
            $out = array_combine($this->header, $out);
        }
        return $out;
    }
901412
def _get_headers(self, resource):
        

        # If the resource is a file we just open it up with the csv
        # reader (after being sure we're reading from the beginning
        # of the file
        if type(resource) == file:
            resource.seek(0)
            reader = csv.reader(resource)
        # If the resource is a basestring it is either a url or a file
        # location, so similarly to the specification mechanism we either
        # access it with an HTTP get request or by opening the file.
        elif isinstance(resource, basestring):
            result = six.moves.urllib.parse.urlparse(resource)
            if result.scheme in ['http', 'https']:
                with closing(requests.get(resource, stream=True)) as response:
                    # Headers are alway the first row of a CSV file
                    # so it's enought to just get the first line and
                    # hopefully save bandwidth
                    header_row = response.iter_lines().next()
            else:
                # It may seem weird to open up a csv file, read its header row
                # and then StringIO that into a new csv reader but this file
                # we want to close and we want the same interface for all
                with open(resource) as resource_file:
                    reader = csv.reader(resource_file)
                    header_row = reader.next()

            reader = csv.reader(cStringIO.StringIO(header_row))
        else:
            raise IOError('Resource type not supported')
        return reader.next()
874618
protected function getHeader()
    {
        ini_set('auto_detect_line_endings', true);
        if (($handle = fopen($this->file, "r")) !== false) {
            $header = fgetcsv($handle, 0, ',');
            static::isHeader($header);

            return $header;
        } else {
            throw new InternalServerErrorException('Could not open uploaded CSV file.');
        }
    }
880931
public HeaderDefinition getHeaderDefinition() {
    JSONArray jsonArray = null;
    try {
      jsonArray = _jsonObject.getJSONArray(COLUMN_NAMES_FIELD);
      List<String> columnNames = new ArrayList<String>(jsonArray.length());
      for (int i = 0; i < jsonArray.length(); i++) {
        columnNames.add(jsonArray.getString(i));
      }
      return HeaderDefinition.of(columnNames);
    } catch (JSONException ex) {
      s_logger.error("Metadata had unexpected structure - could not extract column_names field. Was:\n{}", _jsonObject.toString());
      throw new QuandlRuntimeException("Metadata had unexpected structure", ex);
    }
  }