Read the "OS/2" table

@param in The reader to get the table from
@throws IOException Indicates a failure to read the table
774571
private final void readOS2(FontFileReader in) throws IOException {
        // Check if font is embeddable
        if (dirTabs.get("OS/2") != null) {
            seekTab(in, "OS/2", 2 * 4);
            int fsType = in.readTTFUShort();
            if (fsType == 2) {
                isEmbeddable = false;
            } else {
                isEmbeddable = true;
            }
            in.skip(11 * 2);
            in.skip(10); //panose array
            in.skip(4 * 4); //unicode ranges
            in.skip(4);
            in.skip(3 * 2);
            int v;
            os2Ascender = in.readTTFShort(); //sTypoAscender
            log.debug("sTypoAscender: " + os2Ascender 
                        + " " + (os2Ascender));
            os2Descender = in.readTTFShort(); //sTypoDescender
            log.debug("sTypoDescender: " + os2Descender 
                        + " " + (os2Descender));
            v = in.readTTFShort(); //sTypoLineGap
            log.debug("sTypoLineGap: " + v);
            v = in.readTTFUShort(); //usWinAscent
            log.debug("usWinAscent: " + v  + " " + (v));
            v = in.readTTFUShort(); //usWinDescent
            log.debug("usWinDescent: " + v + " " + (v));
            in.skip(2 * 4);
            v = in.readTTFShort(); //sxHeight
            log.debug("sxHeight: " + v);
            v = in.readTTFShort(); //sCapHeight
            log.debug("sCapHeight: " + v);
            
        } else {
            isEmbeddable = true;
        }
    }
757
public static String readContent( Reader in ) throws IOException
    {
        char[] buffer = new char[2048];
        StringBuilder sb = new StringBuilder();
        int read;
        while ((read = in.read( buffer )) != -1)
        {
            sb.append( buffer, 0, read );
        }

        return sb.toString();
    }
1051797
protected void init() throws IOException {
		if (internalIn2 != null) return;

		String encoding;
		byte bom[] = new byte[BOM_SIZE];
		int n, unread;
		n = internalIn.read(bom, 0, bom.length);

		if ( (bom[0] == (byte)0x00) && (bom[1] == (byte)0x00) &&
				(bom[2] == (byte)0xFE) && (bom[3] == (byte)0xFF) ) {
			encoding = "UTF-32BE";
			unread = n - 4;
		} else if ( (bom[0] == (byte)0xFF) && (bom[1] == (byte)0xFE) &&
				(bom[2] == (byte)0x00) && (bom[3] == (byte)0x00) ) {
			encoding = "UTF-32LE";
			unread = n - 4;
		} else if (  (bom[0] == (byte)0xEF) && (bom[1] == (byte)0xBB) &&
				(bom[2] == (byte)0xBF) ) {
			encoding = "UTF-8";
			unread = n - 3;
		} else if ( (bom[0] == (byte)0xFE) && (bom[1] == (byte)0xFF) ) {
			encoding = "UTF-16BE";
			unread = n - 2;
		} else if ( (bom[0] == (byte)0xFF) && (bom[1] == (byte)0xFE) ) {
			encoding = "UTF-16LE";
			unread = n - 2;
		} else {
			// Unicode BOM not found, unread all bytes
			encoding = defaultEnc;
			unread = n;
		}

		if (unread > 0) internalIn.unread(bom, (n - unread), unread);

		// Use given encoding
		if (encoding == null) {
			internalIn2 = new InputStreamReader(internalIn);
		} else if (strict) {
			internalIn2 = new InputStreamReader(internalIn, Charset.forName(encoding).newDecoder());
		} else {
			internalIn2 = new InputStreamReader(internalIn, encoding);
		}
	}
595486
public static void readLibraryFromStream(final DataInput in) throws IOException {

		final LibraryCacheManager lib = get();
		lib.readLibraryFromStreamInternal(in);

	}
88059
public void readObject (ObjectInputStream in)
        throws IOException, ClassNotFoundException
    {
        int ecount = in.readInt();
        ensureCapacity(ecount);
        for (int ii = 0; ii < ecount; ii++) {
            int key = in.readInt();
            put(key, in.readInt());
        }
    }
1027646
public List<MapRow> readTableConditional(Class<? extends TableReader> readerClass) throws IOException
   {
      List<MapRow> result;
      if (DatatypeConverter.getBoolean(m_stream))
      {
         result = readTable(readerClass);
      }
      else
      {
         result = Collections.emptyList();
      }
      return result;
   }
455942
private void readTable(InputStream is, SynchroTable table) throws IOException
   {
      int skip = table.getOffset() - m_offset;
      if (skip != 0)
      {
         StreamHelper.skip(is, skip);
         m_offset += skip;
      }

      String tableName = DatatypeConverter.getString(is);
      int tableNameLength = 2 + tableName.length();
      m_offset += tableNameLength;

      int dataLength;
      if (table.getLength() == -1)
      {
         dataLength = is.available();
      }
      else
      {
         dataLength = table.getLength() - tableNameLength;
      }

      SynchroLogger.log("READ", tableName);

      byte[] compressedTableData = new byte[dataLength];
      is.read(compressedTableData);
      m_offset += dataLength;

      Inflater inflater = new Inflater();
      inflater.setInput(compressedTableData);
      ByteArrayOutputStream outputStream = new ByteArrayOutputStream(compressedTableData.length);
      byte[] buffer = new byte[1024];
      while (!inflater.finished())
      {
         int count;

         try
         {
            count = inflater.inflate(buffer);
         }
         catch (DataFormatException ex)
         {
            throw new IOException(ex);
         }
         outputStream.write(buffer, 0, count);
      }
      outputStream.close();
      byte[] uncompressedTableData = outputStream.toByteArray();

      SynchroLogger.log(uncompressedTableData);

      m_tableData.put(table.getName(), uncompressedTableData);
   }
1259613
protected HashtableEntry readEntry(long location,
                                       long previous,
                                       int retrieveMode,
                                       boolean checkExpired,
                                       int tableid)
                    throws IOException,
                    EOFException,
                    FileManagerException,
                    ClassNotFoundException,
                    HashtableOnDiskException {

        if (location == 0)
            return null;

        long next = 0;
        int hash = 0;

        initReadBuffer(location);
        next = headerin.readLong();
        hash = headerin.readInt();

        return readEntry2(location, next, hash, previous, retrieveMode, checkExpired, tableid, null, null);
    }
969674
public static Object readObject(DataInput in, Configuration conf)
    throws IOException {
    return readObject(in, null, conf);
  }
1330414
public static String readString(DataInput in) throws IOException {
        int b=in.readByte();
        if(b == 1)
            return in.readUTF();
        return null;
    }
955899
public List<MapRow> readTable(Class<? extends TableReader> readerClass) throws IOException
   {
      TableReader reader;

      try
      {
         reader = readerClass.getConstructor(StreamReader.class).newInstance(this);
      }
      catch (Exception ex)
      {
         throw new RuntimeException(ex);
      }

      return readTable(reader);
   }
887442
public int read() throws IOException {
    if (totalRead >= totalExpected) {
      return -1;
    }

    int result = in.read();
    if (result != -1) {
      totalRead++;
    }
    return result;
  }
882628
public void readTable() {
    // [START bigtable_hw_scan_all_veneer]
    try {
      System.out.println("\nReading the entire table");
      Query query = Query.create(tableId);
      ServerStream<Row> rowStream = dataClient.readRows(query);
      for (Row r : rowStream) {
        System.out.println("Row Key: " + r.getKey().toStringUtf8());
        for (RowCell cell : r.getCells()) {
          System.out.printf(
              "Family: %s    Qualifier: %s    Value: %s%n",
              cell.getFamily(), cell.getQualifier().toStringUtf8(), cell.getValue().toStringUtf8());
        }
      }
    } catch (NotFoundException e) {
      System.err.println("Failed to read a non-existent table: " + e.getMessage());
    }
    // [END bigtable_hw_scan_all_veneer]
  }
79798
public void read(ByteCodeParser in)
    throws IOException
  {
    int length = in.readInt();

    if (length != 2)
      throw new IOException("expected length of 2 at " + length);
    
    int code = in.readShort();
    _signature = in.getUTF8(code);
  }
1194136
public void load(Reader in) {
		try {
			doLoad(in);
		} catch (Exception e) {
			throw Exceptions.propagate(e);
		}
	}
645273
public void read(File file, Table table) throws IOException
   {
      //System.out.println("Reading " + file.getName());
      InputStream is = null;
      try
      {
         is = new FileInputStream(file);
         read(is, table);
      }

      finally
      {
         StreamHelper.closeQuietly(is);
      }
   }
1105209
private final void readName(FontFileReader in) throws IOException {
        seekTab(in, "name", 2);
        int i = in.getCurrentPos();
        int n = in.readTTFUShort();
        int j = in.readTTFUShort() + i - 2;
        i += 2 * 2;

        while (n-- > 0) {
            // getLogger().debug("Iteration: " + n);
            in.seekSet(i);
            final int platformID = in.readTTFUShort();
            final int encodingID = in.readTTFUShort();
            final int languageID = in.readTTFUShort();

            int k = in.readTTFUShort();
            int l = in.readTTFUShort();

            if (((platformID == 1 || platformID == 3) 
                    && (encodingID == 0 || encodingID == 1))
                    && (k == 1 || k == 2 || k == 0 || k == 4 || k == 6)) {
                in.seekSet(j + in.readTTFUShort());
                String txt = in.readTTFString(l);
                
                log.debug(platformID + " " 
                    + encodingID + " "
                    + languageID + " "
                    + k + " " + txt);
                switch (k) {
                case 0:
                    notice = txt;
                    break;
                case 1:
                    familyName = txt;
                    break;
                case 2:
                    subFamilyName = txt;
                    break;
                case 4:
                    fullName = txt;
                    break;
                case 6:
                    fontName = txt;
                    break;
                }
                if (!notice.equals("")
                        && !fullName.equals("")
                        && !fontName.equals("")
                        && !familyName.equals("")
                        && !subFamilyName.equals("")) {
                    break;
                }
            }
            i += 6 * 2;
        }
    }