2014-01-30 3 views
1

HTTP 서버에 epub 파일이 있습니다. 예 : 저자 이름, 책 제목 등을 읽으려고하면 전체 EPUB 파일을 읽습니다. 나는 전체 파일을 읽는 페이지 instent에 의해 페이지를 읽고 싶다. NB : here Android epublib 참조.Android에서 epub 파일을 동시에 읽음

@Override 
    protected String doInBackground(String... params) { 
     try { 
      url = new URL(bookPath); 
      // create the new connection 
      urlConnection = (HttpURLConnection) url.openConnection(); 

      // set up some things on the connection 
      urlConnection.setRequestMethod("GET"); 
      urlConnection.setDoOutput(true); 

      // and connect! 
      urlConnection.connect(); 
      // this will be used in reading the data from the internet 
      inputStream = urlConnection.getInputStream(); 

      // Load Book from inputStream 
      book = (new EpubReader()).readEpub(inputStream); 
      maxLocation = book.getTableOfContents().size(); 
      // get the book's title 
      String bookName = book.getTitle(); 
      String authorName = book.getMetadata().getAuthors().toString(); 

      Log.i("Books", "Title: " + bookName + " Author: " + authorName); 
      title = "Title: " + bookName + " Author: " + authorName; 

      int i = 1; 
      for (TOCReference index : book.getTableOfContents() 
        .getTocReferences()) { 
       stringBuffer.append(index.getTitle() + "</br>"); 
       i++; 
      } 

     } catch (Exception e) { 
      e.printStackTrace(); 
     } 
     return "Executed"; 
    } 
+0

코드에'EpubReader' 란 무엇입니까? 어떤 도서관에서 왔습니까? BTW, EPUB 파일은 여러 파일의 (ZIP) 컨테이너입니다. 메타 데이터를 검사하기 전에 다운로드해야합니다. 또한 EPUB에는 "페이지"라는 개념이 없습니다. 질문을 명확히하십시오. –

+0

[here] (http://www.siegmann.nl/epublib/android) 안드로이드 epublib 참조. –

+0

질문을 명확히 할 수 없는지 질문하십시오. –

답변

1

epublib를 사용하고 있음을 명확히하기 위해 감사드립니다.

epublib에서는 EPUB 파일이 로컬에 있다고 가정하므로 메타 데이터를 읽기 전에 EPUB 파일을 다운로드해야합니다 (완전히!).

클라이언트/서버 응용 프로그램을 디자인하는 경우 메타 데이터 만 서버 측에 추출하여 저장하고 검색/검색 목적으로 클라이언트에서 해당 메타 데이터에 액세스 할 수 있습니다. 그런 다음 사용자가 원하는 책을 선택하면 해당 EPUB 만 기기에 다운로드됩니다.